Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cluster shape variables #79

Merged
merged 30 commits into from
Jun 28, 2024
Merged

Add cluster shape variables #79

merged 30 commits into from
Jun 28, 2024

Conversation

dasphy
Copy link
Contributor

@dasphy dasphy commented Apr 24, 2024

Hi all,
Following PR #72 , more shape variables added for clusters.
These variables showed good separations for photon/pi0 identification.

@BrieucF , @kjvbrt
Tagging @giovannimarchiori , @AlexisMlz , @gartrog

Cheers, Tong

@dasphy
Copy link
Contributor Author

dasphy commented May 5, 2024

Thanks @giovannimarchiori . I pushed a new commit to fix these issues.
Cheers, Tong

@dasphy
Copy link
Contributor Author

dasphy commented May 5, 2024

Related PR in LAr_scripts:
BrieucF/LAr_scripts#26

@BrieucF
Copy link
Contributor

BrieucF commented May 15, 2024

Hi @dasphy , any news on this?

@dasphy
Copy link
Contributor Author

dasphy commented May 15, 2024

Hi @BrieucF , thanks. More shape variables added, will push the updated code later today

@dasphy
Copy link
Contributor Author

dasphy commented Jun 24, 2024

Thank you @kjvbrt , I updated the branch and switched to edm4hep::labels::ShapeParameterNames

Comment on lines 411 to 412
theta2_E_layer[layer+startPositionToFill] += theta_id * theta_id * eCell;
theta_E_layer[layer+startPositionToFill] += theta_id * eCell;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the theta response is better with logE weights, have you tried to calculate the w_theta from the mean theta and theta2 using the logE weights instead of the Ecell weights?

Comment on lines 768 to 775
if (std::isnan(_w_theta_3Bin)) _w_theta_3Bin = 0.;
width_theta_3Bin[layer+startPositionToFill] = _w_theta_3Bin;
if (std::isnan(_w_theta_5Bin)) _w_theta_5Bin = 0.;
width_theta_5Bin[layer+startPositionToFill] = _w_theta_5Bin;
if (std::isnan(_w_theta_7Bin)) _w_theta_7Bin = 0.;
width_theta_7Bin[layer+startPositionToFill] = _w_theta_7Bin;
if (std::isnan(_w_theta_9Bin)) _w_theta_9Bin = 0.;
width_theta_9Bin[layer+startPositionToFill] = _w_theta_9Bin;
Copy link
Contributor

Choose a reason for hiding this comment

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

does it ever happen that the energy sums in 3-5-7-9 bins are zero? This should not happen as long as you have a maximum energy cell with E>0... I'd rather check this or that the energy sums are zero, rather than correcting the nan shower shapes later (they could be nan due to some other bugs and we would not be able to figure out)

@giovannimarchiori
Copy link
Contributor

Hi @dasphy , I finally managed to went through the full code once more after the latest changes.
Overall I didn't spot any obvious bug. I think you should remove capping the values of some variables, and replace the checks for none as suggested. Also, it should be interesting to compare the discriminatning power if the theta width variables are calculating using linear or log energy weights (maybe you could add a boolean flag for that and implement is as an option). That's all from my side

@dasphy
Copy link
Contributor Author

dasphy commented Jun 25, 2024

Hi @dasphy , I finally managed to went through the full code once more after the latest changes. Overall I didn't spot any obvious bug. I think you should remove capping the values of some variables, and replace the checks for none as suggested. Also, it should be interesting to compare the discriminatning power if the theta width variables are calculating using linear or log energy weights (maybe you could add a boolean flag for that and implement is as an option). That's all from my side

Thanks @giovannimarchiori for reviewing the code !
I applied some fixes accordingly. Will implement the logE weights in width calculation.

@kjvbrt
Copy link
Contributor

kjvbrt commented Jun 27, 2024

Hi @dasphy, do you plan to implement the logE weights in this PR?

@dasphy
Copy link
Contributor Author

dasphy commented Jun 27, 2024

Hi @kjvbrt @giovannimarchiori
I implemented the logE weights in width theta calculation

@@ -664,6 +664,7 @@ StatusCode AugmentClustersFCCee::execute([[maybe_unused]] const EventContext &ev
double theta2_E_3Bin = 0.;
double theta_E_3Bin = 0.;
double sum_E_3Bin = 0.;
double sum_weightLog_3Bin = 0.;
Copy link
Contributor

Choose a reason for hiding this comment

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

why declaring/calculating the wightlog variables here and not later inside the if (m_do_widthTheta_logE_weights) {..} block? Maybe the compiler is smart enough to optimise this code, but it makes anyway the code logic a bit harder to follow.

Comment on lines 773 to 776
sum_weightLog_3Bin = weightLog_E_max + weightLog_m1 + weightLog_p1;
sum_weightLog_5Bin = sum_weightLog_3Bin + weightLog_m2 + weightLog_p2;
sum_weightLog_7Bin = sum_weightLog_5Bin + weightLog_m3 + weightLog_p3;
sum_weightLog_9Bin = sum_weightLog_7Bin + weightLog_m4 + weightLog_p4;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as for L667.
And the previous 4 lines (sum_E_3bin = ...) could go inside the else { .. }. block of L787

@kjvbrt
Copy link
Contributor

kjvbrt commented Jun 28, 2024

Nice, merging...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants