slaclab / lcsim

LCSim Java Library
Other
1 stars 5 forks source link

Add feature to update LCIO detector name in event header #46

Closed JeremyMcCormick closed 8 months ago

JeremyMcCormick commented 1 year ago

@normangraf requested the ability to update the detector name in the event header when it is set manually in the conditions manager, to make reprocessing of files easier.

JeremyMcCormick commented 1 year ago

Classes changed with initial commit:

# On branch features/issue-46/add-detector-name-rewrite
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   conditions/src/main/java/org/lcsim/conditions/ConditionsManager.java
#       modified:   conditions/src/main/java/org/lcsim/conditions/ConditionsManagerImplementation.java
#       modified:   event-model/src/main/java/org/lcsim/event/base/BaseLCSimEvent.java
#       modified:   job-manager/src/main/java/org/lcsim/job/ConditionsSetup.java
#       modified:   job-manager/src/main/java/org/lcsim/job/DefaultConditionsSetup.java
#       modified:   job-manager/src/main/java/org/lcsim/job/JobControlManager.java
JeremyMcCormick commented 1 year ago

@normangraf

I believe this is working now according to my testing of your example files on SDF.

I see from the LCIO file dump that the detector name is set to HPS_PhysicsRun2019_Pass2 in the rewritten output file, which seems to be the intention.

You can incorporate into your own builds as follows:

cd lcsim
git checkout features/issue-46/add-detector-name-rewrite
mvn install -DskipTests -T4

Now change the lcsimVersion variable in the hps-java pom.xml file to 4.4.1-SNAPSHOT and rebuild the project.

You should see a new -W option in the job manager that will allow rewriting of the event header from the detector name if it is user supplied as in:

java -server -Djava.util.logging.config.file=./logging.properties -jar ./hps-distribution-5.2-SNAPSHOT-bin.jar PhysicsRun2019FullRecon_pass0_reconFromLCIO.lcsim -d HPS_PhysicsRun2019_Pass2 -i hps_fee_010050.evio.00000-00099_HPS_PhysicsRun2019-v2-FEE-Pass0.slcio -DoutputFile=hps_fee_010050.evio.00000-00099_HPS_PhysicsRun2019-v2-FEE-Pass0_HPS_PhysicsRun2019_Pass2_rerecon -e 1 -n 10 -R 010050 -W

You can verify this on an event-by-event basis by including this snippet in your custom logging.properties file for the job:

org.lcsim.event.base.level = FINEST

I also verified that the old behavior works by looking at the detector name when this option is not used, and it remains unchanged.

I don't think these changes should be merged into the main lcsim branch for now. There could be unintended and unwanted side effects of how I implemented this from changes to some core classes.

JeremyMcCormick commented 1 year ago

Detailed list of changes made to support this feature: