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

MTD simulation: update Track ID stored in MTD SimHits #41318

Merged
merged 12 commits into from
Apr 14, 2023

Conversation

fabiocos
Copy link
Contributor

@fabiocos fabiocos commented Apr 11, 2023

PR description:

This PR addresses two related issues, emerged in the past both in MTD studies and in discussions with HGCal experts (@rovere @felicepantaleo):

  • provide the MC truth for BTL clusters, intended as collection of adjacent crystals within a module hit by the same track entering from tracker;
  • provide a working association between ETL hits and simulated tracks stored in the event, like it is happening for any calorimetric hit.

The latter is simply solved by instrumenting the MtdSD class with code using the caloIDonSurface mechanism implemented in TrackInformation.
The former requires to implement a mechanism similar to that used for the tracker -> calo transition, with the additional complication that BTL is fully embedded in the tracker, and this can generate a bit more complex set of particles configurations.

In order to address this last issue, the TrackInformation class is instrumented with MTD-specific information, packed into a bitted word to avoid multiple bool variables and save memory space. The information about transitions Tracker -> BTL and BTL -> Tracker are managed within the SteppingAction class, while the handling of tracks created within the BTL volume is made in the NewTrackAction class.

The present PR is not supposed to modify the simulation history in terms of track / vertices stored in the event, or hit collections. Only the track ID stored within BTL/ETL hits can be affected. This PR is not completely addressing the problem of tracks created within the BTL volume, at present not stored in the event persistent history, and then entering the calo volume. The cut mechanism enabling the persistent storage is implemented in MtdSD, but left switched off by default (using the standard cuts effectively preventing any action). The possible update of this part, affecting the event history, is deferred to a separate PR.

This PR is in principle ineffective on run2/run3 simulation, but some checks in SteppingAction and NewTrackAction are running also for that. Without an era-dependent flag, I do not see a way to avoid it.

The update of existing MTD geometry regions for ProdCuts should be totally transparent, as they are so far used in one and only one place within CMSSW, and the existing behaviour is kept.

For further discussion, see https://indico.cern.ch/event/1275985/contributions/5359348/attachments/2628038/4545909/MTD-SIM_20230414.pdf

PR validation:

The code behaviour has been studies through detailed history and debugging printout on single muon, electron and pion guns, verifying the correctness of the logic for various cases: particle entering BTL, exiting BTL, loopers re-entering BTL, particles crossing ETL. A test on run2 simulation test wf 11607.0 do not show any difference, as expected.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41318/35129

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @fabiocos (Fabio Cossutti) for master.

It involves the following packages:

  • Geometry/MTDSimData (geometry, upgrade)
  • SimG4CMS/Forward (simulation)
  • SimG4Core/Application (simulation)
  • SimG4Core/Notification (simulation)

@civanch, @Dr15Jones, @bsunanda, @makortel, @mdhildreth, @cmsbuild, @AdrianoDee, @srimanob can you please review it and eventually sign? Thanks.
@makortel, @bsunanda, @rovere, @slomeo this is something you requested to watch as well.
@perrotta, @dpiparo, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@fabiocos
Copy link
Contributor Author

fabiocos commented Apr 11, 2023

@civanch we need to understand how to manage this PR wrt to your #41315

@fabiocos
Copy link
Contributor Author

please test workflow 20834.0

this needs to work also for D88 (i.e. old BTL geometry), as soon as it is supported

@civanch
Copy link
Contributor

civanch commented Apr 11, 2023

@fabiocos , sorry for the mess - I prepared my PR during holiday, likely you did the same. As we discussed before about MC truth, there is no principal contradictions between these PRs, only technical. As far as I see two places:

  1. I have updated TrackInformation class making constructor public and initialize class members in a different way;
  2. substituted NewTrackAction by MCTruthUtil, so it is not anymore class by namespace with utility methods; extra utility method may be added here.

What may be a problem (also we discussed before): I would prefer if SD classes fill TrackInformation container and not fill or create TrackWIthHistory objects. As we agreed, we should first discuss this approach with all involved parties and only after make a migration. The main reason - TrackInformation is design to store this information, we cannot store it in two places. The best approach is to extend TrackInformation if needed and not fill part of information there, another part - in TrackWithHistory with badly controlled relation between two.

@fabiocos
Copy link
Contributor Author

@civanch as you will see reviewing the code, I am not touching TrackWithHistory, all my update is based on TrackInformation. Just let me know whether you would prefer to go first with your update, I will need to rebase my code on top of it.

@cmsbuild
Copy link
Contributor

Pull request #41318 was updated. @civanch, @Dr15Jones, @bsunanda, @makortel, @mdhildreth, @AdrianoDee, @srimanob can you please check and sign again.

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-e3abdb/31938/summary.html
COMMIT: c56b8c3
CMSSW: CMSSW_13_1_X_2023-04-12-1100/el8_amd64_gcc11
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/41318/31938/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 9 lines to the logs
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3554055
  • DQMHistoTests: Total failures: 93
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3553940
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 212 log files, 163 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

@fabiocos
Copy link
Contributor Author

The output of the relval tests appears at least qualitatively consistent with expectations:

  • only MTD histograms are affected
  • SimHits histogram changes show a reduction of the number of track ID associated with energy deposits in MTD cells, consistent with the fact that less track IDs are now stored in the MTD hits, since several of them are moved to the parent track;
  • tracking histograms are consistent with an increase of TrackingParticles with a G4Track appearing in a MTD sim hit, and there are less DetIds with unassociated track IDs in sim hits;
  • no further change is observed in simulated or reconstructed quantities.

@fabiocos
Copy link
Contributor Author

@civanch I have a presentation ready for next simulation meeting, which could be then linked to this PR as supplemental documentation.

@civanch
Copy link
Contributor

civanch commented Apr 12, 2023

+1

energyCut = m_p.getParameter<double>("EnergyThresholdForPersistencyInGeV") * CLHEP::GeV; //default must be 0.5
energyHistoryCut = m_p.getParameter<double>("EnergyThresholdForHistoryInGeV") * CLHEP::GeV; //default must be 0.05

setCuts(energyCut, energyHistoryCut);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this statement would treat tracks in BTL and in ETL in the same way, which is probably something we do not want. I suggest we possibly discuss this for a further development.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fabiocos , yes, in the next rounds I would prefer remove these lines from all SD classes - it is not their job. For now this PR is fine. @srimanob, would you agree?

@civanch
Copy link
Contributor

civanch commented Apr 13, 2023

@srimanob, @AdrianoDee, please, sign this PR, we need it to be merged in order to continue activity on MC truth.

@srimanob
Copy link
Contributor

+Upgrade

From the upgrade-related package, the update on Geometry/MTD* is on existing MTD geometry regions for ProdCuts and MTDNumberingBuilder. The PR test looks fine, and only Phase-2 MTD histograms are effected.

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@civanch
Copy link
Contributor

civanch commented Apr 13, 2023

@perrotta ,@rappoccio, would it be possible to merge this PR? We have other PRs in mind, which should be done on top of it.

@perrotta
Copy link
Contributor

+1

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

Successfully merging this pull request may close these issues.

5 participants