Skip to content

Commit

Permalink
Started CWL implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
GlassOfWhiskey committed Apr 5, 2024
1 parent f839053 commit ea3a267
Show file tree
Hide file tree
Showing 15 changed files with 593 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cwl/clt/generate.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
nevents: int
outputfile: File
type: string
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
python /code/generantuple.py $(inputs.type) $(inputs.nevents) $(inputs.outputfile)
outputs:
outputfile:
outputBinding:
glob: $(inputs.outputfile)
type: File
21 changes: 21 additions & 0 deletions cwl/clt/hepdata.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
combined_model: File
hepdata_data1_yaml: string
hepdata_submission_yaml: string
hepdata_submission_zip: string
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
python /code/hepdata_export.py $(inputs.combined_model) $(inputs.hepdata_submission_yaml) $(inputs.hepdata_data1_yaml)
zip $(inputs.hepdata_submission_zip) $(inputs.hepdata_submission_yaml) $(inputs.hepdata_data1_yaml)
outputs:
hepdata_submission_zip:
outputBinding:
glob: $(inputs.hepdata_submission_zip)
type: File
24 changes: 24 additions & 0 deletions cwl/clt/histogram.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
inputfile: File
outputfile: File
region: string
variations:
inputBinding:
itemSeparator: ','
type: string[]
weight: float
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
python /code/histogram.py $(inputs.inputfile) $(inputs.outputfile) $(inputs.name) $(inputs.weight) $(inputs.variations)
outputs:
outputfile:
outputBinding:
glob: $(inputs.outputfile)
type: File
24 changes: 24 additions & 0 deletions cwl/clt/histogram_shape.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
inputfile: File
outputfile: File
region: string
shapevar: string
variations:
inputBinding:
itemSeparator: ','
type: string[]
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
python /code/histogram.py $(inputs.inputfile) $(inputs.outputfile) $(inputs.name)_$(inputs.shapevar) $(inputs.weight) $(inputs.variations) '{{name}}'
outputs:
outputfile:
outputBinding:
glob: $(inputs.outputfile)
type: File
19 changes: 19 additions & 0 deletions cwl/clt/makews.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
data_bkg_hists: File
workspace_prefix: string
xml_dir: string
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
python /code/makews.py $(inputs.data_bkg_hists) $(inputs.workspace_prefix) $(inputs.xml_dir)
outputs:
workspace:
outputBinding:
glob: $(inputs.workspace_prefix)*combined*model.root
type: File
18 changes: 18 additions & 0 deletions cwl/clt/merge_root.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-env-root6:6.18.04
inputs:
mergedfile: string
inputs: File[]
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
hadd $(inputs.mergedfile) $(inputs.inputs)
outputs:
mergedfile:
outputBinding:
glob: $(inputs.mergedfile)
type: File[]
20 changes: 20 additions & 0 deletions cwl/clt/merge_root_allpars.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-env-root6:6.18.04
inputs:
background: string
data: string
mergedfile: string
signal: File[]
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
hadd $(inputs.mergedfile) $(inputs.signal) $(inputs.data) $(inputs.background)
outputs:
mergedfile:
outputBinding:
glob: $(inputs.mergedfile)
type: File
28 changes: 28 additions & 0 deletions cwl/clt/plot.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
combined_model: File
fit_results: string
nominal_vals: string
postfit_plot: string
prefit_plot: string
baseCommand: [bash, select.sh]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
hfquickplot write-vardef $(inputs.combined_model) combined $(inputs.nominal_vals)
hfquickplot plot-channel 4(inputs.combined_model) combined channel1 x $(inputs.nominal_vals) -c qcd,mc2,mc1,signal -o $(inputs.prefit_plot)
hfquickplot fit $(inputs.combined_model) combined $(inputs.fit_results)
hfquickplot plot-channel $(inputs.combined_model) combined channel1 x $(inputs.fit_results) -c qcd,mc2,mc1,signal -o $(inputs.postfit_plot)
outputs:
postfit:
outputBinding:
glob: $(inputs.postfit_plot)
type: File
prefit:
outputBinding:
glob: $(inputs.prefit_plot)
type: File
20 changes: 20 additions & 0 deletions cwl/clt/select.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
inputfile: File
outputfile: File
region: string
variations: string
baseCommand: [bash, select.sh]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
python /code/select.py $(inputs.inputfile) $(inputs.outputfile) $(inputs.region) nominal
outputs:
outputfile:
outputBinding:
glob: $(inputs.outputfile)
type: File
23 changes: 23 additions & 0 deletions cwl/clt/select_mc.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: docker.io/reanahub/reana-demo-bsm-search:1.0.0
inputs:
inputfile: File
outputfile: File
region: string
variations:
inputBinding:
itemSeparator: ","
type: string[]
baseCommand: [bash, -c]
arguments:
- valueFrom: |
source /usr/local/bin/thisroot.sh
python /code/select.py $(inputs.inputfile) $(inputs.outputfile) $(inputs.region) $(inputs.variations)
outputs:
outputfile:
outputBinding:
glob: $(inputs.outputfile)
type: File
77 changes: 77 additions & 0 deletions cwl/databkgmc.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
cwlVersion: v1.2
class: Workflow
inputs: {}
outputs:
postfit:
outputSource: plot/postfit.pdf
type: File
prefit:
outputSource: plot/prefit.pdf
type: File
steps:
all_bkg_mc:
run: wflow_all_mc.cwl
in:
mcname:
default: ['mc1', 'mc2']
mcweight:
default: [0.01875, 0.0125]
nevents:
default: 40000
out: [mergedfile]
data:
run: workflow_data.cwl
in:
nevents:
default: 20000
out: [mergedfile]
signal:
run: workflow_sig.cwl
in:
nevents:
default: 40000
mcweight:
default: 0.0025
out: [mergedfile]
merge:
run: clt/merge_root_allpars.cwl
in:
backgorund: all_bkg_mc/mergedfile
data: data/mergedfile
mergedfile:
valueFrom: 'merged.root'
signal: signal/mergedfile
out: [mergedfile]
makews:
run: clt/makews.cwl
in:
data_bkg_hists: merge/mergedfile
workspace_prefix:
default: 'results/workspace'
xml_dir:
default: 'xmldir'
out: [workspace]
plot:
run: clt/plot.cwl
in:
combined_model: makews/workspace
nominal_vals:
default: 'nominal_vals.yml'
fit_results:
default: 'fit_results.yml'
prefit_plot:
default: 'prefit.pdf'
postfit_plot:
default: 'postfit.pdf'
out: [postfit, prefit]
hepdata:
run: clt/hepdata.cwl
in:
combined_model: makews/workspace
hepdata_submission_zip:
default: 'submission.zip'
hepdata_submission_yaml:
default: 'submission.yaml'
hepdata_data1_yaml:
default: 'data1.yaml'
out: [hepdata_submission_zip]
34 changes: 34 additions & 0 deletions cwl/wflow_all_mc.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cwlVersion: v1.2
class: Workflow
inputs:
nevents: int
mcname: string[]
mcweight: float[]
outputs:
mergedfile:
outputSource: merge/mergedfile
type: File[]
steps:
run_mc:
run: workflow_mc.cwl
in:
nevents: nevents
mcname: mcname
mcweight: mcweights
shapevars:
default:
- - shape_conv_up
- - shape_conv_dn
weightvariations:
default:
- 'nominal'
- 'weight_var1_up'
- 'weight_var1_dn'
out: [mergeallvars]
merge:
run: clt/merge_root.cwl
in:
inputs: run_mc/mergeallvars
mergedfile:
default: 'merged.root'
out: [mergedfile]
Loading

0 comments on commit ea3a267

Please sign in to comment.