Skip to content

[PWGHF] Replace UPC Lc THnSparse with TTree#15786

Draft
Rrantu wants to merge 13 commits intoAliceO2Group:masterfrom
Rrantu:Lc
Draft

[PWGHF] Replace UPC Lc THnSparse with TTree#15786
Rrantu wants to merge 13 commits intoAliceO2Group:masterfrom
Rrantu:Lc

Conversation

@Rrantu
Copy link
Copy Markdown
Contributor

@Rrantu Rrantu commented Apr 15, 2026

This PR introduces a transition from THnSparse to TTree in the UPC Lc analysis.
Main changes:

  • Added UPC Lc columns and tables in utilsUpcHf.h
  • Implemented production and filling of TTree in taskLc.cxx
  • Removed UPC-related axes from the THnSparse

@github-actions github-actions Bot added the pwghf PWG-HF label Apr 15, 2026
@github-actions github-actions Bot changed the title Replace UPC Lc THnSparse with TTree [PWGHF] Replace UPC Lc THnSparse with TTree Apr 15, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

O2 linter results: ❌ 0 errors, ⚠️ 0 warnings, 🔕 0 disabled

@vkucera vkucera marked this pull request as draft April 15, 2026 12:54
@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 15, 2026

@Rrantu Columns and tables are parts of the data model. They don't belong in the utility headers.

@Rrantu
Copy link
Copy Markdown
Contributor Author

Rrantu commented Apr 15, 2026

Hi @vkucera, thanks for the comment, where would you recommend moving the columns and tables to? Would it be acceptable to define them directly in the task?

@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 15, 2026

Hi @vkucera, thanks for the comment, where would you recommend moving the columns and tables to? Would it be acceptable to define them directly in the task?

Yes, if the tables are not used anywhere else, please put them in the task.

@Rrantu Rrantu marked this pull request as ready for review April 15, 2026 14:03
@lubynets
Copy link
Copy Markdown
Contributor

Dear @Rrantu, @vkucera, all codeowners, sorry for interfering,
Are Tasks, and not TableProducers, supposed to produce trees? https://aliceo2group.github.io/analysis-framework/docs/gettingstarted/theo2physicsrepo.html#folder-structure

@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 15, 2026

Dear @Rrantu, @vkucera, all codeowners, sorry for interfering, Are Tasks, and not TableProducers, supposed to produce trees? https://aliceo2group.github.io/analysis-framework/docs/gettingstarted/theo2physicsrepo.html#folder-structure

No, they are not.

@Rrantu
Copy link
Copy Markdown
Contributor Author

Rrantu commented Apr 15, 2026

Hi @lubynets, Thanks for the question. In this case, the tables are only used within this task, and the trees are produced specifically for this analysis. Also, there are other tasks that produce trees in a similar way.

@Rrantu
Copy link
Copy Markdown
Contributor Author

Rrantu commented Apr 17, 2026

Hi @vkucera, could you please take a look at my updated code?

Comment thread PWGHF/D2H/Tasks/taskLc.cxx Outdated
@Rrantu Rrantu requested a review from vkucera April 20, 2026 08:01
@vkucera vkucera marked this pull request as draft April 20, 2026 08:08
@Rrantu Rrantu marked this pull request as ready for review April 20, 2026 08:28
@Rrantu
Copy link
Copy Markdown
Contributor Author

Rrantu commented Apr 20, 2026

Hi @vkucera, when you have time, could you please take a look at my updated? Thanks!

Comment thread PWGHF/D2H/Tasks/taskLc.cxx Outdated
Comment thread PWGHF/D2H/Tasks/taskLc.cxx Outdated
@Rrantu Rrantu requested a review from vkucera April 23, 2026 11:04
if (gap == o2::aod::sgselector::TrueGap::SingleGapA || gap == o2::aod::sgselector::TrueGap::SingleGapC) {
std::vector<double> valuesToFill{massLc, pt, outputBkg, outputPrompt, outputFD, static_cast<double>(numPvContributors), static_cast<double>(fitInfo.ampFV0A), static_cast<double>(fitInfo.ampFT0A), static_cast<double>(fitInfo.ampFT0C), static_cast<double>(zdcEnergyZNA), static_cast<double>(zdcEnergyZNC), static_cast<double>(zdcTimeZNA), static_cast<double>(zdcTimeZNC)};
registry.get<THnSparse>(HIST("hnLcUpcVarsWithBdt"))->Fill(valuesToFill.data());
rowCandUpcBdt(massLc, pt, outputBkg, outputPrompt, outputFD, static_cast<float>(fitInfo.ampFV0A), static_cast<float>(fitInfo.ampFT0A), static_cast<float>(fitInfo.ampFT0C), static_cast<float>(zdcTimeZNA), static_cast<float>(zdcTimeZNC));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What types are the values before casting?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

float FV0AmplitudeA(TFV0 fv0)

Before casting the values are of type float.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why do you cast them to the same type?

@Rrantu Rrantu requested a review from vkucera April 23, 2026 12:13
@gluparel
Copy link
Copy Markdown
Collaborator

Dear @Rrantu, @vkucera, all codeowners, sorry for interfering, Are Tasks, and not TableProducers, supposed to produce trees? https://aliceo2group.github.io/analysis-framework/docs/gettingstarted/theo2physicsrepo.html#folder-structure

No, they are not.

Hi @vkucera, actually I am in favour of what suggested by @lubynets and I would avoid to add trees here and I would suggest to use the Lc TreeCreator: https://github.com/AliceO2Group/O2Physics/blob/master/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx

Grazia

@alibuild
Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for 44d3060 at 2026-04-23 18:06:

No log files found

Full log here.

@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 23, 2026

Dear @Rrantu, @vkucera, all codeowners, sorry for interfering, Are Tasks, and not TableProducers, supposed to produce trees? https://aliceo2group.github.io/analysis-framework/docs/gettingstarted/theo2physicsrepo.html#folder-structure

No, they are not.

Hi @vkucera, actually I am in favour of what suggested by @lubynets and I would avoid to add trees here and I would suggest to use the Lc TreeCreator: https://github.com/AliceO2Group/O2Physics/blob/master/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx

Grazia

Hi @gluparel , what are your reasons in favour of that?
My main reason against is that the logic of selecting candidates and filling them in the trees in the task is quite complicated and very different from the way the tree creator output is filled. Adding the same logic in the tree creator for one specific analysis does not seem justified to me and it would cause code duplication which would bring further maintenance work.

@zhangbiao-phy
Copy link
Copy Markdown
Collaborator

zhangbiao-phy commented Apr 23, 2026

Dear @Rrantu, @vkucera, all codeowners, sorry for interfering, Are Tasks, and not TableProducers, supposed to produce trees? https://aliceo2group.github.io/analysis-framework/docs/gettingstarted/theo2physicsrepo.html#folder-structure

No, they are not.

Hi @vkucera, actually I am in favour of what suggested by @lubynets and I would avoid to add trees here and I would suggest to use the Lc TreeCreator: https://github.com/AliceO2Group/O2Physics/blob/master/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx
Grazia

Hi @gluparel , what are your reasons in favour of that? My main reason against is that the logic of selecting candidates and filling them in the trees in the task is quite complicated and very different from the way the tree creator output is filled. Adding the same logic in the tree creator for one specific analysis does not seem justified to me and it would cause code duplication which would bring further maintenance work.

Hi @vkucera @gluparel @lubynets, I agree with Vít’s comments here. Regarding adding a tree to the Lc task, I also understand the concerns raised by Grazia and Oleksii. To avoid making things more complicated, I would suggest that @Rrantu create a new dedicated task in the D2H folder (e.g. taskLcUPC.cxx, or more generally taskCharmUPC.cxx). We could also consider using such a task for all HF UPC analyses (different process function for different particle). This would be more appropriate since the event selection and logic are quite different from the standard Lc or other HF task. what do you think?

@gluparel
Copy link
Copy Markdown
Collaborator

Dear @Rrantu, @vkucera, all codeowners, sorry for interfering, Are Tasks, and not TableProducers, supposed to produce trees? https://aliceo2group.github.io/analysis-framework/docs/gettingstarted/theo2physicsrepo.html#folder-structure

No, they are not.

Hi @vkucera, actually I am in favour of what suggested by @lubynets and I would avoid to add trees here and I would suggest to use the Lc TreeCreator: https://github.com/AliceO2Group/O2Physics/blob/master/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx
Grazia

Hi @gluparel , what are your reasons in favour of that? My main reason against is that the logic of selecting candidates and filling them in the trees in the task is quite complicated and very different from the way the tree creator output is filled. Adding the same logic in the tree creator for one specific analysis does not seem justified to me and it would cause code duplication which would bring further maintenance work.

Hi @vkucera @gluparel @lubynets, I agree with Vít’s comments here. Regarding adding a tree to the Lc task, I also understand the concerns raised by Grazia and Oleksii. To avoid making things more complicated, I would suggest that @Rrantu create a new dedicated task in the D2H folder (e.g. taskLcUPC.cxx, or more generally taskCharmUPC.cxx). We could also consider using such a task for all HF UPC analyses (different process function for different particle). This would be more appropriate since the event selection and logic are quite different from the standard Lc or other HF task. what do you think?

Hello @zhangbiao-phy , @vkucera , my point is that this task is used by various analyses and we would start to add various trees for the various analyses which need different information. Is this the direction we would like to take? Another option is to have a dedicated task for HF UPC analysis as indeed suggested by Biao and this could be indeed a good option for me, since the various UPC analysis use the same event selections but just a different particle creator.

@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 24, 2026

Hi @gluparel @zhangbiao-phy , thanks for your feedback. I like the idea of a common workflow for UPC analyses if a majority of the code can be shared by multiple species. And if the primary output is expected to have many dimensions, it would indeed be worth making it as a tree creator, as @lubynets pointed out.

@Rrantu
Copy link
Copy Markdown
Contributor Author

Rrantu commented Apr 24, 2026

Hi @gluparel @zhangbiao-phy , thanks for your feedback. I like the idea of a common workflow for UPC analyses if a majority of the code can be shared by multiple species. And if the primary output is expected to have many dimensions, it would indeed be worth making it as a tree creator, as @lubynets pointed out.

Thanks for the suggestion. I will try to separate the UPC part into a new task file

@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 24, 2026

Hi @gluparel @zhangbiao-phy , thanks for your feedback. I like the idea of a common workflow for UPC analyses if a majority of the code can be shared by multiple species. And if the primary output is expected to have many dimensions, it would indeed be worth making it as a tree creator, as @lubynets pointed out.

Thanks for the suggestion. I will try to separate the UPC part into a new task file

Thanks @Rrantu , feel free to mark the PR as ready for review when you push the updates. Please do not create a new PR. Just updated this one.

@vkucera vkucera marked this pull request as draft April 24, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pwghf PWG-HF

Development

Successfully merging this pull request may close these issues.

6 participants