Repository navigation
[PWGHF] Adding option to include reconstructed rapidity in MC THnSparse in D2H/Tasks/taskDplus.cxx - #18828
Conversation
|
O2 linter results: ❌ 0 errors, |
|
Hi @lmattei01 , who are you? |
|
@lmattei01 Please fix the title. It does not mention which part of HF you changed. |
Hi @vkucera , thanks for the suggestion. I am a PhD student working on Jpsi-D+ associated production and I need reconstructed rapidity in the THnSparse of D+ on order to create 2D efficiency maps (pT vs y) |
I meant your name. Please add it on your profile and check the rest of the contribution guidelines. |
| if (storeRecRapidity) { | ||
| axes.push_back(thnAxisY); | ||
| axesFD.push_back(thnAxisY); | ||
| } |
There was a problem hiding this comment.
I suggest you to put it at the end of all the configurable axes (after the other if (store...)); this because other analysers expect axes in a given position, and adding this now might change the position of axes in the outputs, creating confusion in other analyses
| } else if (!storeCentrality && !storeOccupancy && storeRecRapidity) { | ||
| registry.fill(HIST("hSparseMassPrompt"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], HfHelper::yDplus(candidate)); |
There was a problem hiding this comment.
you should in principle add all the combinations, in fact currently if a user enables rapidity the rapidity with other optional variables, it gives a runtime error (or you forbid the activation of rapidity with other optional variables, throwing a FATAL with a meaningful error message)
There was a problem hiding this comment.
@lmattei01, one more suggestion: you can pack all the values to be filled (depending on boolean configurables) to the vector and then call the Fill() function only once. Otherwise when you attempt to foresee all the combinations, the number of LOC will grow in geometric progression.
As a reference you can have a look at the similar code for Lc baryon https://github.com/AliceO2Group/O2Physics/blob/dfbc8da2c9f7ff7cbd1f2cfed3787a3a45510ebb/PWGHF/D2H/Tasks/taskLc.cxx
There was a problem hiding this comment.
Hello Lorenzo, thanks for implementing the suggestions! They look fine for me with two notes:
- subtraction of "2" in the FD vector size when reserving it (I commented in the code);
- the added rapidity axis (and vector element) is still in front of two FD-specific values, PtBHad and FlagBHad. But let Fabrizio comment on it whether it is critical.
There was a problem hiding this comment.
Hi @lubynets, since all the optional axes are added before the B-related ones, I think it's OK to keep it as it is now (I guess analysers are expecting the two additional B axes in the last positions). Also I think it's good to have the common axes in the same position for prompt and non-prompt sparses.
Please consider the following formatting changes to AliceO2Group#18828
| registry.fill(HIST("hSparseMassFD"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors, ptbhad, flagBHad, HfHelper::yDplus(candidate)); | ||
| } else { | ||
| registry.fill(HIST("hSparseMassFD"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], ptbhad, flagBHad); | ||
| valuesToFillMcRec.reserve(registry.get<THnSparse>(HIST("hSparseMassFD"))->GetNdimensions() - 2); |
There was a problem hiding this comment.
I subtract 2 because the two additional B axes are declared at the beginning but only filled later on, using "push_back". So I wanted to reserve (NdimensionFD - 2), which is the number of data I insert in the sparse right away
There was a problem hiding this comment.
I am not sure that understand your point. First of all, the statement about 2 FD-specific values is also applicable to any optional value, say rapidity - you push_back() them, not insert(). And secondly, due to underreservation the vector size you may lose the performance because of data reallocation when two last push_back() are called.
But the most curious thing for me is what is your motivation to reserve less elements than eventually the vector will have?
There was a problem hiding this comment.
I had some bad memory about allocation rules for vectors.
Sorry for the mess with the commits, it should be solved now!
This reverts commit 0601dac64444556288081a59ddead9067ed0ad79.
Adding option to include reconstructed rapidity in MC THnSparse in D2H/Tasks/taskDplus.cxx