Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

need to enter the output event file before creating and writing #93

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

tomeichlersmith
Copy link
Member

ROOT requires us to be in the correct directory when we create
the output TTree for us to have it written into the correct
location.

In order to allow downstream processors to getHistoDirectory()
and enter that directory for the histograms we need to enter
the output event file again here so that our run tree ends up
in the correct location.

ROOT requires us to be in the correct directory when we create
the output TTree for us to have it written into the correct
location.

In order to allow downstream processors to `getHistoDirectory()`
and enter that directory for the histograms we need to enter
the output event file again here so that our run tree ends up
in the correct location.
@tomeichlersmith
Copy link
Member Author

Alright, I added a fake analyzer to the framework-testbench that just calls getHistoDirectory() during processing and a config that can test using this analyzer both in a production run and a recon run.

I can confirm the issues observed in LDMX-Software/ldmx-sw#1255 and LDMX-Software/ldmx-sw#1256 by running this analyzer with Framework v1.4.1 (current trunk).

# inside the denv for framework-testbench
tom@framework-testbench:~$ fire config/histogramming.py 
---- LDMXSW: Loading configuration --------
---- LDMXSW: Configuration load complete  --------
---- LDMXSW: Starting event processing --------
 [ Process ] 1 : Processing 1 Run 1 Event 1  (2024-01-30 15:33:34.436424000+0000)
 [ Process ] 1 : Processing 2 Run 1 Event 2  (2024-01-30 15:33:34.461226000+0000)
 [ Process ] 1 : Processing 3 Run 1 Event 3  (2024-01-30 15:33:34.461311001+0000)
 [ Process ] 1 : RunHeader { run: 1, numTries: 3, detectorName: , description: 
  intParameters: 
    RandomNumberMasterSeed[hist] = 1
  floatParameters: 
  stringParameters: 
}
---- LDMXSW: Event processing complete  --------
tom@framework-testbench:~$ rootls test_processormove_*.root:*
test_processormove_events.root :
  LDMX_Events
test_processormove_hist.root :
  LDMX_Run  LDMX_Run

Re-compiling with this branch and re-running this config resolves this issue:

tom@framework-testbench:~$ fire config/histogramming.py 
---- LDMXSW: Loading configuration --------
---- LDMXSW: Configuration load complete  --------
---- LDMXSW: Starting event processing --------
 [ Process ] 1 : Processing 1 Run 1 Event 1  (2024-01-30 15:34:52.268631000+0000)
 [ Process ] 1 : Processing 2 Run 1 Event 2  (2024-01-30 15:34:52.286868000+0000)
 [ Process ] 1 : Processing 3 Run 1 Event 3  (2024-01-30 15:34:52.286953001+0000)
 [ Process ] 1 : RunHeader { run: 1, numTries: 3, detectorName: , description: 
  intParameters: 
    RandomNumberMasterSeed[hist] = 1
  floatParameters: 
  stringParameters: 
}
---- LDMXSW: Event processing complete  --------
tom@framework-testbench:~$ rootls test_processormove_*.root:*
test_processormove_events.root :
  LDMX_Events  LDMX_Run
test_processormove_hist.root :
tom@framework-testbench:~$ fire config/produce.py 
---- LDMXSW: Loading configuration --------
---- LDMXSW: Configuration load complete  --------
---- LDMXSW: Starting event processing --------
 [ Process ] 1 : Processing 1 Run 1 Event 1  (2024-01-30 15:36:26.325298000+0000)
 [ Process ] 1 : Processing 2 Run 1 Event 2  (2024-01-30 15:36:26.341166000+0000)
 [ Process ] 1 : Processing 3 Run 1 Event 3  (2024-01-30 15:36:26.341330001+0000)
 [ Process ] 1 : RunHeader { run: 1, numTries: 3, detectorName: , description: 
  intParameters: 
    RandomNumberMasterSeed[prod] = 1
  floatParameters: 
  stringParameters: 
}
---- LDMXSW: Event processing complete  --------
tom@framework-testbench:~$ fire config/histogramming.py test_produce.root 
---- LDMXSW: Loading configuration --------
---- LDMXSW: Configuration load complete  --------
---- LDMXSW: Starting event processing --------
 [ Process ] 1 : Opening file test_produce.root
 [ Process ] 1 : Got new run header from 'test_processormove_events.root' ...
RunHeader { run: 1, numTries: 3, detectorName: , description: 
  intParameters: 
    RandomNumberMasterSeed[prod] = 1
  floatParameters: 
  stringParameters: 
}
 [ Process ] 1 : Processing 1 Run 1 Event 1  (2024-01-30 15:36:32.621931000+0000)
 [ Process ] 1 : Processing 2 Run 1 Event 2  (2024-01-30 15:36:32.624864000+0000)
 [ Process ] 1 : Processing 3 Run 1 Event 3  (2024-01-30 15:36:32.624957000+0000)
 [ Process ] 1 : Closing file test_produce.root
---- LDMXSW: Event processing complete  --------
tom@framework-testbench:~$ rootls test_processormove_*.root:*
test_processormove_events.root :
  LDMX_Events  LDMX_Run
test_processormove_hist.root :
tom@framework-testbench:~$ rootls test_produce.root:*
LDMX_Events  LDMX_Run

Copy link
Member Author

@tomeichlersmith tomeichlersmith left a comment

Choose a reason for hiding this comment

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

Alright, I've checked that the different configs in framework-testbench are functional and this doesn't introduce a regression of any kind.

I also checked to see if we could move the writeRunTree call to within the destructor and the answer is No. Because we are just holding an address to a RunHeader that is owned by Process during a production run, there can be a seg vio at the end of running if the RunHeader is de-allocated before the EventFile is. It is just easier to call writeRunTree when we are cleanly ending a run (production or recon).

@tomeichlersmith tomeichlersmith merged commit 1eb1fba into trunk Jan 30, 2024
1 check passed
@tomeichlersmith tomeichlersmith deleted the run-header-write-location-patch branch January 30, 2024 15:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant