Mu2e / TrkAna

Track-based analysis TTree maker working in the art framework
Apache License 2.0
2 stars 20 forks source link

Guard against empty MC truth objects #174

Open edcallaghan opened 3 months ago

edcallaghan commented 3 months ago

https://github.com/Mu2e/Offline/pull/1245 implemented a modality in which StrawDigis may be read from external files, as opposed to being simulated. A consequence of this is the production of MC-truth objects associated with these digis, for which no MC truth actually exists. In TrkAna, this manifests as data-corruption when inspecting TrkStrawHitMC objects. In particular, inspection of reasonably-assumed-to-exist-but-nevertheless-absent SimParticles cause exceptions --- for example, here: https://github.com/Mu2e/TrkAna/blob/main/src/InfoMCStructHelper.cc#L101. All accesses to TrkStrawHitMCs should query the "provenance" field (TrkStrawHitMC::_provenance), and short-circuit the relevant inspection if the provenance is TrkStrawHitMCProvenance::External. I suppose that a dummy value must then be propagated to the trees or flag field be introduced so that the entries without true MC information can be masked out from analysis. I can get to implementing the guards, but I'll defer to the TrkAna experts on the best choice as to how this should actually propagate to the output trees.

brownd1978 commented 3 months ago

Could you please provide an example file which includes ‘external’ digis?

David Brown @.*** Office Phone (510) 486-7261 Lawrence Berkeley National Lab M/S 50R5008 (50-6026C) Berkeley, CA 94720

On Mon, Jun 24, 2024 at 17:25 Ed Callaghan @.***> wrote:

Mu2e/Offline#1245 https://github.com/Mu2e/Offline/pull/1245 implemented a modality in which StrawDigis may be read from external files, as opposed to being simulated. A consequence of this is the production of MC-truth objects associated with these digis, for which no MC truth actually exists. In TrkAna, this manifests as data-corruption when inspecting TrkStrawHitMC objects. In particular, inspection of reasonably-assumed-to-exist-but-nevertheless-absent SimParticles cause exceptions --- for example, here: https://github.com/Mu2e/TrkAna/blob/main/src/InfoMCStructHelper.cc#L101. All accesses to TrkStrawHitMCs should query the "provenance" field ( TrkStrawHitMC::_provenance), and short-circuit the relevant inspection if the provenance is TrkStrawHitMCProvenance::External. I suppose that a dummy value must then be propagated to the trees or flag field be introduced so that the entries without true MC information can be masked out from analysis. I can get to implementing the guards, but I'll defer to the TrkAna experts on the best choice as to how this should actually propagate to the output trees.

— Reply to this email directly, view it on GitHub https://github.com/Mu2e/TrkAna/issues/174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAH576VGKTOOVCQDDHLTUDZJC2GDAVCNFSM6AAAAABJ2YUVDWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM3TCMZVGE3DIOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

AndrewEdmonds11 commented 3 months ago

Thanks, Ed. We have a similar situation with the genealogy of SimParticles, where we have already compressed out some of the older generations. For this we have a valid leaf in the SimInfo branch (https://github.com/Mu2e/TrkAna/blob/9e4d29d3fd75cce7c1184e4cede073cd0a2dfe95/inc/SimInfo.hh#L15). I think the same solution here would be good. Could you implement that at the same time as you implement the guards?

edcallaghan commented 3 months ago

@brownd1978 You can look at ~ejc3/mu2e/dm/effect/dm-ce/out/000/000.art on the fnal machines (should be public-readable, let me know if not). This is a small sample of digi-mixed conversion electrons in which the pileup digis are all External.