ldmx-sw icon indicating copy to clipboard operation
ldmx-sw copied to clipboard

Optimize ecal biasing factor for 8 GeV

Open tvami opened this issue 10 months ago • 27 comments

I am updating ldmx-sw, here are the details.

What are the issues that this addresses?

Resolves https://github.com/LDMX-Software/ldmx-sw/issues/1535

Check List

  • [x] I successfully compiled ldmx-sw with my developments
  • [x] I ran my developments and the following shows that they are successful.

See https://github.com/LDMX-Software/ldmx-sw/issues/1535#issuecomment-2625960556

tvami avatar Feb 03 '25 15:02 tvami

I'm gonna use this PR to test https://github.com/LDMX-Software/ldmx-sw/pull/1569

tvami avatar Feb 04 '25 05:02 tvami

/run-validation

tvami avatar Feb 04 '25 16:02 tvami

The validation workflow is running here: https://github.com/LDMX-Software/ldmx-sw/actions/runs/13140056694.

github-actions[bot] avatar Feb 04 '25 16:02 github-actions[bot]

I think this works now!

tvami avatar Feb 04 '25 16:02 tvami

I'll test if it also works in a draft mode

tvami avatar Feb 04 '25 16:02 tvami

/run-validation

tvami avatar Feb 04 '25 16:02 tvami

The validation workflow is running here: https://github.com/LDMX-Software/ldmx-sw/actions/runs/13140159042.

github-actions[bot] avatar Feb 04 '25 16:02 github-actions[bot]

  Switched to a new branch 'iss1535-biasing-factor-optimization'
  branch 'iss1535-biasing-factor-optimization' set up to track 'origin/iss1535-biasing-factor-optimization'.

Yaay it does! Sorry everybody if you got more than than a dozen msg because of this!

tvami avatar Feb 04 '25 16:02 tvami

I'm opening this for review, as we agreed today that this will not affect anything in the DR and is safe to merge

tvami avatar Feb 10 '25 21:02 tvami

Here are the ecal shower plots: compare_230_550_bias_factor_ecal_shower.pdf

Looks pretty good

tvami avatar Feb 12 '25 22:02 tvami

I meant this to be a sanity check... No warnings in 10k events! But the ECAL and PN (and HCAL & TS even) distributions change a lot ecal_pn_recon_validation_plots.pdf

tvami avatar Feb 16 '25 17:02 tvami

@tvami LOL yes that z distribution is telling. All interactions in the first possible instance!

bryngemark avatar Feb 17 '25 17:02 bryngemark

Exactly :D Would be good to have an earlier measure that helps to find the optimal number before having to look at the Z distribution

tvami avatar Feb 17 '25 17:02 tvami

this is the Z vertex with a factor of a 1000: Screenshot 2025-02-17 at 14 13 22

tvami avatar Feb 17 '25 22:02 tvami

Here is the rest of the KS-failed distributions: change_bias_factor_1000-ecal_pn_recon_validation_plots.pdf

tvami avatar Feb 17 '25 22:02 tvami

With a factor 1000 it looks like we're getting about 10% more events in the first two bins than we used to (btw is the reference with 8 GeV/550, or 4 GeV/450?). I think this could still mean that we're getting a large enough xsc to trigger a warning but it is suppressed.

Did you get around to running with old_ecal? That should factor the low-Z materials out of the problem. If we can run without these materials, maybe finding the maximum warning-free biasing factor would be a good procedure to optimize without having to look at z.

bryngemark avatar Feb 18 '25 09:02 bryngemark

(btw is the reference with 8 GeV/550, or 4 GeV/450?).

with ref to 8 GeV/550

Did you get around to running with old_ecal?

Not yet, but sounds good

tvami avatar Feb 18 '25 15:02 tvami

I suggest we discuss this at the sw dev meeting today and type up what we learn from that and the email thread with natalia in this issue afterwards.

bryngemark avatar Feb 19 '25 11:02 bryngemark

Let's test with the new gold

tvami avatar Feb 20 '25 20:02 tvami

Screenshot 2025-02-20 at 17 52 09 Screenshot 2025-02-20 at 17 52 33

tvami avatar Feb 21 '25 01:02 tvami

So a little bit more interactions in the non-W part of the ecal, but it seems the with a factor of a 1000 it's not too different.

Reminder about the Z dist (now with the clean gold, and normalized plots with error bars): Screenshot 2025-02-20 at 17 56 43

tvami avatar Feb 21 '25 01:02 tvami

The rest of the plots that fail the KS (reminder the red is with 550 and the blue is with 1000) bias-opt-ecal_pn_recon_validation_plots.pdf

tvami avatar Feb 21 '25 02:02 tvami

Results in https://github.com/LDMX-Software/ldmx-sw/actions/runs/13469761175

The z with using biasing factor of 5000

Screenshot 2025-02-25 at 14 38 09

Material Screenshot 2025-02-25 at 14 38 38

Volume Screenshot 2025-02-25 at 14 38 57

So more is happening now in the non-W based elements, I guess this was expected

tvami avatar Feb 25 '25 22:02 tvami

I'll check now how things look like for biasing factor of 1

tvami avatar Feb 25 '25 23:02 tvami

I'll check now how things look like for biasing factor of 1

Ohh so with biasing factor of 1 the ecalPN takes longer than 6 hours to run, so github kills it...

tvami avatar Mar 05 '25 15:03 tvami

@tvami did this move along lately? were you able to run some tests outside of the CI action?

bryngemark avatar Apr 01 '25 10:04 bryngemark

@tvami did this move along lately? were you able to run some tests outside of the CI action?

Not really, after I'm done with the DR stuff I'll come back to this

tvami avatar Apr 03 '25 21:04 tvami

PN_pn_gamma_int_z.pdf PN_pn_interaction_material.pdf PN_pn_vertex_volume.pdf

I conclude that we are good with the 550 as is.

Btw, the 1100 still doesn't trigger the warning, but it clearly biases the z distribution

tvami avatar Jun 14 '25 23:06 tvami

@tomeichlersmith I agree with that sentiment, but "old_ecal" is in the software: https://github.com/LDMX-Software/ldmx-sw/blob/8f4cc8a0416855eb7647dd5ad79b615649a1972c/SimCore/src/SimCore/DetectorConstruction.cxx#L67-L68 etc it just didnt have the python config to use it, so I thought the consistent behavior is to add it. But I'm fine to remove it if you feel strongly about this.

tvami avatar Jun 16 '25 16:06 tvami

I would be happy to remove that old_ecal now. It was in reference to which volumes were being biased and I made the regretful decision to do the physics testing on trunk instead of on a separate branch (like you've done here). I don't think anyone should use old_ecal and thus, removing it is preferable.

tomeichlersmith avatar Jun 16 '25 16:06 tomeichlersmith