Skip to content

Conversation

@Mingze129
Copy link
Contributor

For now, the task include data and Reco-level MC analysis only.

@github-actions
Copy link

github-actions bot commented Aug 5, 2025

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

@github-actions github-actions bot changed the title Adding Dstar spin alignment in jet analysis task [PWGHF] Adding Dstar spin alignment in jet analysis task Aug 5, 2025
@Mingze129 Mingze129 changed the title [PWGHF] Adding Dstar spin alignment in jet analysis task [PWGHF] Adding Dstar spin alignment in jet analysis task Aug 5, 2025
@github-actions github-actions bot added the pwgje label Aug 5, 2025
@Mingze129 Mingze129 changed the title [PWGHF] Adding Dstar spin alignment in jet analysis task [PWGHF,PWGJE] Adding Dstar spin alignment in jet analysis task Aug 5, 2025
@Mingze129 Mingze129 changed the title [PWGHF,PWGJE] Adding Dstar spin alignment in jet analysis task [PWGHF, PWGJE] Adding Dstar spin alignment in jet analysis task Aug 5, 2025
@github-actions github-actions bot changed the title [PWGHF, PWGJE] Adding Dstar spin alignment in jet analysis task [PWGHF,PWGJE] [PWGHF,PWGJE] Adding Dstar spin alignment in jet analysis task Aug 5, 2025
@github-actions github-actions bot changed the title [PWGHF,PWGJE] [PWGHF,PWGJE] Adding Dstar spin alignment in jet analysis task [PWGHF,PWGJE] Adding Dstar spin alignment in jet analysis task Aug 5, 2025
@Mingze129 Mingze129 marked this pull request as ready for review August 5, 2025 12:50
Comment on lines 665 to 667
template <charm_polarisation::DecayChannel channel, bool withMl, bool doMc, typename Jet, typename Cand>
bool runPolarisationAnalysis(Jet const& jet, Cand const& candidate, int bkgRotationId)
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is channel a template argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed channel from the templated argument list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about others? like withMl and doMc, should I move them as well?

Copy link
Collaborator

@vkucera vkucera Sep 8, 2025

Choose a reason for hiding this comment

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

I don't think you can remove them in this case, because you need the flagMcMatchRec, mlScores columns whose availability depends on the table subscriptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it fine now?

Comment on lines 733 to 735
threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()},
std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()},
std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't you use the candidate momentum directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use candidate momentum directly now.

Comment on lines 283 to 284
void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, float invMassCharmHad, float ptCharmHad, float rapCharmHad, float invMassD0, float cosThetaStar, const std::array<float, 3>& outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t nMuons, bool isPartRecoDstar, float zParallel, float jetPt)
{
Copy link
Collaborator

@vkucera vkucera Sep 8, 2025

Choose a reason for hiding this comment

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

The amount of parameters makes the function calls super error-prone.
It would be much safer to pass a const& to a single object, like a struct or a map.
Even better would be to remove the function completely by simplifying the body.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would keep fillRecoHistos since it is called several times for different cases (also in view to extend the task to other particles, such as Lc, it would be good to keep it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use struct pass parameters.

@github-actions
Copy link

This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.

@github-actions github-actions bot added the stale label Oct 24, 2025
@Mingze129
Copy link
Contributor Author

@vkucera I have updated the code, Could you please review it again when you are free?

@github-actions github-actions bot removed the stale label Oct 28, 2025
@Mingze129 Mingze129 requested a review from vkucera October 30, 2025 10:22
/// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks
/// \param nMuons is the number of muons from daughter decays
/// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar meson (MC only)
void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, bool withMl, bool doMc, bool isPartRecoDstar, HfHistoInput& recoHistoInput)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, bool withMl, bool doMc, bool isPartRecoDstar, HfHistoInput& recoHistoInput)
void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, bool withMl, bool doMc, bool isPartRecoDstar, HfHistoInput const& recoHistoInput)

Comment on lines +285 to +298
/// \param invMassCharmHad is the invariant-mass of the candidate
/// \param ptCharmHad is the pt of the candidate
/// \param rapCharmHad is the rapidity of the candidate
/// \param invMassD0 is the invariant-mass of the D0 daugher (only for D*+)
/// \param cosThetaStar is the cosThetaStar of the candidate
/// \param outputMl is the array with ML output scores
/// \param isRotatedCandidate is a flag that keeps the info of the rotation of the candidate for bkg studies
/// \param origin is the MC origin
/// \param ptBhadMother is the pt of the b-hadron mother (only in case of non-prompt)
/// \param absEtaMin is the minimum absolute eta of the daughter tracks
/// \param numItsClsMin is the minimum number of ITS clusters of the daughter tracks
/// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks
/// \param nMuons is the number of muons from daughter decays
/// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar meson (MC only)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update the documentation

}
if (activateTHnSparseCosThStarHelicity) {
// helicity
cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2());
Copy link
Collaborator

Choose a reason for hiding this comment

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

You only need one sqrt.

Comment on lines +67 to +68
Configurable<float> minRotAngleMultByPi{"minRotAngleMultByPi", 5. / 6, "Minimum angle rotation for track rotation, to be multiplied by pi"};
Configurable<float> maxRotAngleMultByPi{"maxRotAngleMultByPi", 7. / 6, "Maximum angle rotation for track rotation, to be multiplied by pi"};
Copy link
Collaborator

@vkucera vkucera Nov 12, 2025

Choose a reason for hiding this comment

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

  • Put the attributes Min, Max at the end.
  • The name suggests that the value is the product of the rotation angle and Pi, however the help string suggests that it is the ratio of the angle and Pi.
  • You define a default value for a float as double/int. Make it consistent.

Comment on lines +724 to +726
std::array<float, 3> threeVecSoftPi{candidate.pxProng1() * std::cos(bkgRotAngle) - candidate.pyProng1() * std::sin(bkgRotAngle), candidate.pxProng1() * std::sin(bkgRotAngle) + candidate.pyProng1() * std::cos(bkgRotAngle), candidate.pzProng1()}; // we rotate the soft pion
std::array<float, 3> threeVecD0Prong0{candidate.pxProng0Charm(), candidate.pyProng0Charm(), candidate.pzProng0Charm()};
std::array<float, 3> threeVecD0Prong1{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()};
Copy link
Collaborator

Choose a reason for hiding this comment

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

The scope is wrong. These are used only inside the if (bkgRotationId > 0) block.

Comment on lines +724 to +726
std::array<float, 3> threeVecSoftPi{candidate.pxProng1() * std::cos(bkgRotAngle) - candidate.pyProng1() * std::sin(bkgRotAngle), candidate.pxProng1() * std::sin(bkgRotAngle) + candidate.pyProng1() * std::cos(bkgRotAngle), candidate.pzProng1()}; // we rotate the soft pion
std::array<float, 3> threeVecD0Prong0{candidate.pxProng0Charm(), candidate.pyProng0Charm(), candidate.pzProng0Charm()};
std::array<float, 3> threeVecD0Prong1{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
std::array<float, 3> threeVecSoftPi{candidate.pxProng1() * std::cos(bkgRotAngle) - candidate.pyProng1() * std::sin(bkgRotAngle), candidate.pxProng1() * std::sin(bkgRotAngle) + candidate.pyProng1() * std::cos(bkgRotAngle), candidate.pzProng1()}; // we rotate the soft pion
std::array<float, 3> threeVecD0Prong0{candidate.pxProng0Charm(), candidate.pyProng0Charm(), candidate.pzProng0Charm()};
std::array<float, 3> threeVecD0Prong1{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()};
const std::array threeVecSoftPi{candidate.pxProng1() * std::cos(bkgRotAngle) - candidate.pyProng1() * std::sin(bkgRotAngle), candidate.pxProng1() * std::sin(bkgRotAngle) + candidate.pyProng1() * std::cos(bkgRotAngle), candidate.pzProng1()}; // we rotate the soft pion
const std::array threeVecD0Prong0{candidate.pxProng0Charm(), candidate.pyProng0Charm(), candidate.pzProng0Charm()};
const std::array threeVecD0Prong1{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()};

/// \param candidates are the selected candidates
/// \param bkgRotationId is the id for the background rotation
/// \return true if candidate in signal region
template <bool withMl, bool doMc, typename Jet, typename Cand>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
template <bool withMl, bool doMc, typename Jet, typename Cand>
template <bool WithMl, bool DoMc, typename Jet, typename Cand>

# or submit itself to any jurisdiction.
# or submit itself to any jurisdiction.

add_subdirectory(Tasks)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think in the end the new task should go in the PWGJE directory, since it's input are JE tables.

@github-actions
Copy link

This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.

@github-actions github-actions bot added the stale label Dec 13, 2025
@github-actions github-actions bot closed this Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants