PWGHF: Make transition from McParticles_000 to McParticles_001#510
Conversation
| int indexDaughterLast = particleMother.daughtersIds().back(); // index of the last direct daughter | ||
| if ((indexDaughterFirst > -1 && indexDaughterLast > -1)) { | ||
| std::vector<int> arrAllDaughtersIndex; | ||
| RecoDecay::getDaughters(particlesMC, particleMother, &arrAllDaughtersIndex, array{(int)(kGamma), (int)(pdg::Code::kJpsi)}, 1); |
There was a problem hiding this comment.
As just discussed in the meeting: Replace by just has_daughters(). The index values themselves are not used elsewhere
|
Actually, there are a few more places in |
Should be done everywhere now! |
|
Further improvements foreseen after this PR AliceO2Group/AliceO2#8113 gets merged |
|
@jgrosseo @vkucera the PR should be now updated using the methods implemented in AliceO2Group/AliceO2#8113 and |
vkucera
left a comment
There was a problem hiding this comment.
The code looks fine. Just please fix the removed comments.
vkucera
left a comment
There was a problem hiding this comment.
The code looks fine. Just please fix the removed comments.
vkucera
left a comment
There was a problem hiding this comment.
Thanks a lot Fabrizio!
Please verify that the MC plots from the validation framework match the reference.
| for (auto& dau : particle.template daughters_as<typename std::decay_t<T>::parent_t>()) { | ||
| getDaughters(dau, list, arrPDGFinal, depthMax, stage); | ||
| } |
There was a problem hiding this comment.
@vkucera when this piece of code is executed I get the following error:
[ERROR] Exception caught: Unable to find column with label fIndexMcCollisions
even if I checked and the column fIndexMcCollisions is present in the O2mccollisionlabel table in the AO2D file that I am analysing.
I wrote this piece of code following what was suggested by @aalkin for
particleMother = particleMother.template mothers_first_as<typename std::decay_t<T>::parent_t>();
however I am not sure that it works also in this case. I also tried by replacing typename std::decay_t<T>::parent_t with simply aod::McParticles but I get the same error. @aalkin @jgrosseo do you have any suggestion? Thanks!
There was a problem hiding this comment.
@fgrosa this particular exception is raised when constructing a table. When the slice index is unset it is supposed to return empty table. It may happen that this actually creates an empty table with no schema and thus the construction fails. For now you can protect this piece of code with check for has_daughters().
There was a problem hiding this comment.
Hi @aalkin thanks! Unfortunately even if I put the protection:
if (particle.has_daughters()) {
for (auto& dau : particle.template daughters_as<typename std::decay_t<T>::parent_t>()) {
getDaughters(dau, list, arrPDGFinal, depthMax, stage);
}
}it keeps crashing with the same error. Do you have any other idea by chance?
There was a problem hiding this comment.
I will have to debug this, I assume the line auto dauTable = particle.template daughters_as<typename std::decay_t<T>::parent_t>(); would crash as well, could you check?
There was a problem hiding this comment.
Checking for has_daughters() has no effect here because this line is reached only if has_daughters() returned true.
There was a problem hiding this comment.
@aalkin indeed it crashes as well. @vkucera right because if isFinal is true and has_daughters() is false it goes through the first if statement, but the it returns anyway before this part of the code.
I think that one possible solution would be to loop over indices in this case instead of getting the sliced table of daughters, but it would require to pass again the MC particle table as argument. However I have no better ideas at the moment. What do you think?
There was a problem hiding this comment.
@aalkin Would this work?
template <std::size_t N, typename T>
static void getDaughters(const typename T::iterator& particle,
...
for (auto& dau : particle.daughters_as<T>()) {There was a problem hiding this comment.
@vkucera I doubt this will be able to deduce type automatically from a function call, but it is better to check explicitly.
|
Hi @jgrosseo @vkucera @aalkin with my last commit I reverted the code to the usage of |
|
I agree to move ahead and merge this. Could you subsequently, prepare a PR where you put |
|
Waiting for @vkucera approval of course... |
Co-authored-by: Vít Kučera <vit.kucera@cern.ch>
Co-authored-by: Vít Kučera <vit.kucera@cern.ch>
| if (rightDecayChannels) { //fill with D and Dbar daughter particls acceptance checks | ||
| bool candidate1DauInAcc = true; | ||
| bool candidate2DauInAcc = true; | ||
| for (auto& dau : particle1.daughters_as<MCParticlesPlus>()) { | ||
| if (std::abs(dau.eta()) > etaCut) { | ||
| candidate1DauInAcc = false; | ||
| break; | ||
| } | ||
| } | ||
| for (auto& dau : particle2.daughters_as<MCParticlesPlus>()) { | ||
| if (std::abs(dau.eta()) > etaCut) { | ||
| candidate2DauInAcc = false; | ||
| break; | ||
| } | ||
| } | ||
| if (candidate1DauInAcc && candidate2DauInAcc && particle1.pt() > ptCut && particle2.pt() > ptCut) { |
There was a problem hiding this comment.
@fcolamar Can you please check these changes in your tasks and confirm that you are fine with them?
@jgrosseo @vkucera @fcolamar please double check that I did not mess up anything. Thanks a lot!