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

First pass at extracting digis from tracks #1343

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

edcallaghan
Copy link
Contributor

@edcallaghan edcallaghan commented Sep 24, 2024

This PR implements a modules which deep-copies StrawDigis and StrawDigiWaveforms which are associated with a reconstructed track via KalSeed into new *Collections. This PR is marked as a draft for now; more detail will be added here before it's necessary to initiate review.

New module:

  • TrackDigiExtractor: Given a KalSeedCollection, produces a StrawDigiCollection and StrawDigiADCWaveformCollection which contain data products pointed to by KalSeeds in the specified collection. Future development implement include data products from the calorimeter.

@FNALbuild
Copy link
Collaborator

Hi @edcallaghan,
You have proposed changes to files in these packages:

  • Blinding

which require these tests: build.

@Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main.

⌛ The following tests have been triggered for c086bf4: build (Build queue is empty)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at c086bf4.

Test Result Details
test with Command did not list any other PRs to include
merge Merged c086bf4 at 38f72f8
build (prof) Log file. Build time: 08 min 48 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
FIXME, TODO TODO (0) FIXME (0) in 1 files
clang-tidy 🔶 0 errors 103 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at c086bf4 after being merged into the base branch at 38f72f8.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@edcallaghan edcallaghan marked this pull request as draft September 24, 2024 19:06
Copy link
Collaborator

@brownd1978 brownd1978 left a comment

Choose a reason for hiding this comment

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

I wonder if it makes sense to combine this module with the time-shifting module, as I suspect both will end up needing to reference a track, and both otherwise produce and consume the same products. It seem more efficient to do this in one pass.

@FNALbuild
Copy link
Collaborator

📝 The HEAD of main has changed to 5694fbe. Tests are now out of date.

@edcallaghan
Copy link
Contributor Author

@FNALbuild run build test

@FNALbuild
Copy link
Collaborator

⌛ The following tests have been triggered for c086bf4: build (Build queue is empty)

@edcallaghan edcallaghan marked this pull request as ready for review December 9, 2024 23:50
@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at c086bf4.

Test Result Details
test with Command did not list any other PRs to include
merge Merged c086bf4 at 11e1039
build (prof) Log file. Build time: 04 min 19 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
FIXME, TODO TODO (0) FIXME (0) in 1 files
clang-tidy 🔶 0 errors 103 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at c086bf4 after being merged into the base branch at 11e1039.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@edcallaghan
Copy link
Contributor Author

I wonder if it makes sense to combine this module with the time-shifting module, as I suspect both will end up needing to reference a track, and both otherwise produce and consume the same products. It seem more efficient to do this in one pass.

@brownd I envision the two as needing to be distinct via the following reasoning:
i) The offspill job needs to write an output stream containing the digis which may be used for blinding. To minimize the size on disk, that stream would only consist of digis taken from this module.
ii) The onspill job performs the actual sculpting, which in this case (time) may depend on the onspill run configuration (we could change the digitization window, or something like that).

When you propose that this part of the chain would reference the track, I assume you mean to use some fit t0 as the reference time for the track. That makes sense, but we would use the time relevant for the fit after mixing these digis with onspill pileup, not the time of the relatively clean offspill track, so there's no need to propagate the latter from the offspill job.

@brownd1978
Copy link
Collaborator

@FNALbuild run build test

@FNALbuild
Copy link
Collaborator

⌛ The following tests have been triggered for fefea3d: build (Build queue has 1 jobs)

@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at fefea3d.

Test Result Details
test with Command did not list any other PRs to include
merge Merged fefea3d at e3e7160
build (prof) Log file. Build time: 04 min 19 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
FIXME, TODO TODO (0) FIXME (0) in 1 files
clang-tidy 🔶 0 errors 103 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at fefea3d after being merged into the base branch at e3e7160.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

for (const auto& kalseed: *kalseeds){
// tracker
auto seeds = kalseed.hits();
for (const auto& seed: seeds){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Its not clear to me we want to keep the inactive hits in this use case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only place I can identify this being set is in the TrkStrawHitSeed constructor, where it propagates from a WireHitState --- it looks like this is still a fit-level construct (e.g., it contains the decision on left/right ambiguity), so is contextual to the fit. If that's the case, then I think we'd want to keep the inactive hits, as they could become active when fit in the presence of pileup. Is that a reasonable take?

Or, if I'm wrong about the above, then we have to ask whether only propagating active hits risks a break in blindness. Since these are overlaid onto pileup which could contribute hits to the fit but end up inactive, the answer may be no, but it's worth mentioning.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In OffSpill cosmic track events, the inactive hits will mostly be poorly measured hits created by the primary particle, so you want to keep them. However in a mixed event, many/most of the inactive hits will be from pileup, so you would not want to keep them if you planned to re-mix the extracted digis.
I think the current code covers 90% of the foreseeable use cases, lets go with this for now. If in future we want to use this code to extract digis from events with pileup we can extend it to include a hit selection algorithm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, that all makes sense.

auto strawadcss = event.getValidHandle<StrawDigiADCWaveformCollection>(_strawdigi_tag);

// sanity checks
if (strawhits->size() != strawdigis->size()){
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test relies on this module's config being consistent with what was used when fitting the tracks.

A way to ensure consistency is to use the KKTrack instead of KalSeed; KKTrack can have Ptrs back to underlying collections, but it cannot be persisted, due to payload that includes std::Ptrs. We can discuss if that makes sense in this context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, ok. The current implementation does depend on this check passing, as e.g. StrawHits and StrawDigis do not contain any ptrs to each other. To be sure that both for a given hit are included, we have to assume that the collections in which they are contained are aligned (and the best check we have for that is same-length).

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a long-term issue that we need to improve the robustness of the digi->hit->trkhit indexing using ProductPtr, which didn't exist when the original codes were written. That's beyond the scope of this PR. We can deal with this code when we address that issue in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me.

public:
struct Config{
// track
fhicl::Atom<art::InputTag> kalseed_tag{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it conceivable this module will need to coherently process multiple KalSeed collections (ie multiple particle hypotheses)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is conceivable, but IMO unlikely for the conversion-blinding use case where we really only want electron-like tracks. Maybe we'll determine that selecting another stream is useful for some book-keeping purpose, but I doubt that we'd want to collate that with the electron-likes at this stage.

@brownd1978 brownd1978 merged commit 3398e30 into Mu2e:main Dec 12, 2024
14 checks passed
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.

3 participants