forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inject ticl into the RECO fragment. (cms-sw#70)
* Inject ticl into the RECO fragment as option. * Complain when ticl injection failed. * Add note on ticl in RECO fragment to README.
- Loading branch information
Showing
5 changed files
with
239 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# This script injects the lines required to run ticl into a | ||
# reconstruction fragment obtained through (e.g.) runTheMatrix.py. | ||
# | ||
# A function is used to be able to use local variables. | ||
# | ||
# Arguments: | ||
# 1. fragment_file: The file to update inline. | ||
|
||
action() { | ||
# get and check arguments | ||
local fragment_file="$1" | ||
if [ -z "$fragment_file" ]; then | ||
2>&1 echo "please pass a fragment file as argument 1" | ||
return "1" | ||
fi | ||
if [ ! -f "$fragment_file" ]; then | ||
2>&1 echo "the fragment file '$fragment_file' does not exist" | ||
return "2" | ||
fi | ||
|
||
# define what to inject where | ||
local hook="# customisation of the process." | ||
local content="# run TICL\nfrom RecoHGCal.TICL.ticl_iterations import TICL_iterations_withReco\nprocess = TICL_iterations_withReco(process)" | ||
|
||
# do the injection | ||
sed "/$hook/a $content" -i "$fragment_file" | ||
} | ||
action "$@" |
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