Skip to content

Conversation

@mvicenzi
Copy link
Member

@mvicenzi mvicenzi commented Aug 14, 2025

This PR implements the vision originally laid out from the discussion in #2 . It provides most of the infrastructural changes, although one key item in particular is missing and will need another PR. It is quite a fat one, so please take your time to review it in full. Many thanks to @koolz2151 for her help in getting this started.

List of changes

  • The simulation output is being separated between common information and detector-specific trees. The common trees are: event (currently only filling the eventID -- see below), primaries (storing primary particles for each vertex in the event) and trajectories (optional, stores tracks for all particles in the even).
  • Detector-specifc output trees are moved into subdirectories of the output ROOT file. Each detector has full freedom to customize their outputs in their directory (multiple trees, histograms, etc).
  • The .mac parameters are update to be in the \out\ directory for general settings and \out\<detector>\ for specific settings that impact the output of a single detector (eg., \out\flare\pseudoReco).
  • By default, output directories and trees are booked only if corresponding SDs are detected in the geometry. Single detectors can add flags to ovveride this and turn the output off (eg., \out\faser\saveActs false disables the output of FASER2 regardless whether it was included or not in the geometry).
  • The FASER2 ACTS trees have been moved under the "faser2" TDirectory in the output file.
  • FLArE output trees now contain: a flare_hits tree for liquid argon hits, hcal_hits tree for the BabyMIND/HCAL hits. If the save2DEvd option is enabled, 2D histograms are saved in sub-directories of the flare output directory. If pseudoReco is true, a pseud-reco tree is also written to the flare directory.
  • The step size user limit of 0.5 mm in LAr has been removed in order to keep the output file size reasonable. Need to discuss more on a full strategy.
  • In order for the pseudo-reco information to work, an association between each trackID and its ancestor primary particle needs to be built. This now happens through a map belonging to AnalysisManager, which is updated in StackingAction right as a track is registered. The "custom" definition of primary particle (like direct decays of primary lepton being treated as primaries) is no longer being used, including the TrackInformation filled in TrackingAction -- to be discussed in items 2 and 3 below.
  • AnalysisManager::EndOfEvent has been extensively cleaned-up. Trees are booked and filled in separate functions. Generally, it's much easier to navigate the file.
  • FLArE geometry has been updated to simplify the GDML output: TPCLayerLogical has been removed in favor of direct placement of the 21 TPC logical modules.
  • reco/CircleFit has been removed.
  • Submission scripts to work on the BNL-SDCC cluster have been added.

What still remains open:

These are items that still need to be completed, but I believe it's best to push this PR through before proceeding.
The first one is key, while the other three are less urgent. I will open sub-issues to track them properly.

  1. Fill the event TTree with generator-level information. This requires introducing a general way to store generator metadata that can work across the different generators we support. More in Generator-level info in event output tree #17 .
  2. Merge primaries and trajectories into a single "particles" tree which will contain the entire particle hierarchy. Add a flag to enable saving the full trajectories. It would serve as the ACTS particle tree as well. More in Merge primaries and trajectories into a single "particles" tree #18 .
  3. Revist the FLArE output: can we move the pseudo-reco in a downstream ad-hoc package? can we reduce the output size by binning in 3D while keeping a smaller step size in lAr? Prepare new SD/Hit classes for FLArE HCAL. More in Refining FLArE outputs #19 .
  4. Add initial output trees for FASERnu2 and FORMOSA. More in Minimal FORMOSA/FASERnu2 output #20 .

Other small tweaks to the output formats might be needed, but I think these are the biggest open things. Out of which getting an usable event tree is the highest priority.

@mvicenzi mvicenzi self-assigned this Aug 14, 2025
@benw22022
Copy link
Contributor

benw22022 commented Aug 15, 2025

Thanks @mvicenzi and @koolz2151 for this overhaul!! I'll review this as soon as I can! Just to give you a heads up, I'm a bit busy these next couple of weeks due prepping for the FASER collaboration meeting, so I might need a bit longer than usual to review this

Copy link
Contributor

@benw22022 benw22022 left a comment

Choose a reason for hiding this comment

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

Thanks again @mvicenzi and @koolz2151 for this really nice PR! I have a couple of small suggested changes which I think would be nice to add before merging

In AnalysisManager.cc:

  • Could we make its so that the HDF5 is only written out if FLArE is enabled?

In AnalysisManagerMessenger.h:

  • Should probably refactor class member variables to use a consistent naming pattern i.e.
    outDir $\rightarrow$ fOutDir

@mvicenzi
Copy link
Member Author

Thanks @benw22022 -- I added your suggestions!
@WenjieWu-Sci Let me know if you also want to see any changes before merging. Thanks!

Copy link
Contributor

@WenjieWu-Sci WenjieWu-Sci left a comment

Choose a reason for hiding this comment

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

This is tons of work, thank you. I just have two comments, maybe for future PRs.

  1. The 0.5 mm step limit was originally set trying to look for the kink when tau decays in the detector. I tried with lower step limit, but would crash because of taking up too much memory. I think in general cases, we probably don't need this fine granularity. But it would be good to have it as least as an option.
  2. I agree it's a good idea to move the pseudo-reco part into another package.

@mvicenzi
Copy link
Member Author

  1. The 0.5 mm step limit was originally set trying to look for the kink when tau decays in the detector. I tried with lower step limit, but would crash because of taking up too much memory. I think in general cases, we probably don't need this fine granularity. But it would be good to have it as least as an option.

@WenjieWu-Sci That's a good point. I will add it in the to-dos of #19 .

@mvicenzi mvicenzi merged commit 3d757cf into main Aug 19, 2025
@mvicenzi mvicenzi deleted the output_flare branch September 16, 2025 12:53
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.

5 participants