-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better support to treat events from HepMC event files (multi-timefram…
…e case) Some users give existing .hepmc files to the event generator. So far, this was problematic because separate timeframes will read from the same file and due to a lack of synchronization, each timeframe read the same events. This is now fixed. Whenever an hepmc event file is given as input to O2DPG-MC, we make sure that timeframes read from the HepMC file incrementally. This is achieved through: - sequentially producing events for timeframes - communication of the number processed from one timeframe to the next (via HepMCEventSkip.json file).
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# Path to the JSON file | ||
JSON_FILE=$1 | ||
tf=$2 | ||
JQCOMMAND="jq '[.[] | select(.tf < ${tf}) | .HepMCEventCount] | add' ${JSON_FILE}" | ||
eval ${JQCOMMAND} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Path to the JSON file | ||
JSON_FILE=${1:-HepMC_EventSkip_ALT.json} | ||
tf=$2 | ||
|
||
# Value to set or add | ||
EVENTS=$(grep "DISTRIBUTING" ../tf${tf}/sgngen_*.log | tail -n 1 | awk '//{print $5}') | ||
|
||
[ -f $JSON_FILE ] || echo "[]" > ${JSON_FILE} # init json file if it doesn't exist | ||
# insert event count ... if a count for this tf does not already exist | ||
JQ_COMMAND="jq 'if any(.[]; .tf == ${tf}) then . else . + [{\"tf\": ${tf}, "HepMCEventCount": ${EVENTS}}] end' ${JSON_FILE} > tmp_123.json; mv tmp_123.json ${JSON_FILE}" | ||
eval ${JQ_COMMAND} |