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

PMT Waveform Simulation #324

Open
wants to merge 12 commits into
base: Application
Choose a base branch
from

Conversation

atcsutton
Copy link
Contributor

Describe your changes

Here's a second try at this PR after some cleanup, extension, and optimization.

The primary change is adding in the PMTWaveformSim tool. Details on the implementation can be found on docDB: https://annie-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=5821. One major change that has been implemented since that presentation is a time optimization. Originally, I was simulating a full 70 us readout window for every hit. That means ~35000 samples, which is very time intensive. Now, I am only simulating up to the latest hit time for each PMT. Adding the waveform simulation cause about 2X more run time compared to just using the true MCHits. However, the ClusterFinder is still much more intensive; needing about 20s to run over a single test file, compared to the 4s that PMTWaveformSim requires.

I have also included some minor changes to downstream tools that allows us to incorporate the simulated waveforms. PhaseIIADCHitFinder needed some specific changes and a new running mode flag. Additionally, I added the ability to skip an execute loop in PhaseIIADCHitFinder, ClusterFinder, and BackTracker. The skip variable is set in the ANNIEEvent by PMTWaveformSim in the case that there are no good MCHits to simulate. Skipping the execute of downstream tools prevents unnecessary error prints from occurring.

The final change is unrelated to the waveform simulation, but is an issue I found during this work. As reported on the last slide of the above docDB, the baseline variance calculation implemented in PhaseIIADCCalibrator::make_calibrated_waveforms_ze3ra_multi is incorrect. Originally, the noise sigma was determined by taking the variance of multiple baseline means. In the case of a single baseline sample this procedure will return a variance of 0. The proper thing to do is to average out the variances of each baseline mean estimation. Additionally, there is a feature which uses the "first baseline" if all of the determined baselines are too noisy. In that case, the original implementation would inadvertently set the baseline to 0.

Breakdown of the 21 files changed:
8 are part of the example ToolChain config
3 are the actual tool (header, source, and readme)
2 are the extension of ADCPulses to record their stop time.
2 are extending BackTracker to handle MC waveforms
3 are changes to PhaseIIADCHitFinder and ClusterFinder to handle MC waveforms
2 are generic changes to Unity and Factory
1 is the PhaseIIADCCalibrator bug fix

Checklist before submitting your PR

  • [✔︎] This PR implements a single change (one new/modified Tool, or a set of changes to implement one new/modified feature)
  • [✔︎] This PR alters the minimum number of files to affect this change
  • [✔︎] If this PR includes a new Tool, a README and minimal demonstration ToolChain is provided
  • [✔︎] If a new Tool/ToolChain requires model or configuration files, their paths are not hard-coded, and means of generating those files is described in the readme, with examples provided on /pnfs/annie/persistent
  • [✔︎] For every new usage, there is a reason the data must be on the heap
  • [✔︎] For every new there is a delete, unless I explicitly know why (e.g. ROOT or a BoostStore takes ownership)

Additional Material

Attach any validation or demonstration files here. You may also link to relavant docdb articles.

Andrew Sutton and others added 12 commits November 21, 2024 13:12
…. Also change TGraph pointer to an object.
…/ToolAnalysis into feature/asutton_MCPMTWaveforms
…ly need them to interface with BackTracker. Second, adding the stop_time to the ADCPulse (have version control and default value for backward compatibility). Third, integrating BackTracker. Fourth, allowing for an upstream tool to signal to PhaseIIADCHitFinder, ClusterFinder, and BackTracker that a given Execute step will be skipped. This occurs if there are no MCHits to process or if no good waveforms are produced, and prevents red herring errors from being thrown.
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.

1 participant