cms-analysis / CombineHarvester

CMSSW package for the creation, editing and analysis of combine datacards and workspaces
cms-analysis.github.io/CombineHarvester/
15 stars 180 forks source link

segmentation violation Error using partialCorrelationEdit.py script #247

Open setesami opened 3 years ago

setesami commented 3 years ago

Hello, I have installed the latest version of combine tool and CombineHarvester and I tried the "partialCorrelationEdit.py" script using one of the simple shape Datacard examples in the CMSSW_10_2_13/src/HiggsAnalysis/CombinedLimit/data/benchmarks/shapes/simple-shapes-TH1.txt

with the following command python ../../../../../CombineHarvester/CombineTools/scripts/partialCorrelationEdit.py simple-shapes-TH1.txt -m 125 --process lumi,0.6 but I always get the segmentation violation Error at the last stage of the script[1]. I also tried with different datacards but always get the same problem. could you please let me know if I am missing something or there is an issue with the script? Thanks Mohsen

[1][SetFlag] Changing value of flag "workspace-uuid-recycle" from 1 to 1 [SetFlag] Changing value of flag "workspaces-use-clone" from 0 to 1 [SetFlag] Changing value of flag "import-parameter-err" from 1 to 0 [SetFlag] Changing value of flag "zero-negative-bins-on-import" from 0 to 0 [SetFlag] Changing value of flag "check-negative-bins-on-import" from 1 to 0

Setting correlation coefficient of lumi to 0.600000 The following systematics will be cloned and adjusted:

mass analysis era channel bin id process sig nuisance type value sh_d sh_u

125 1 0 signal 1 lumi lnN 1.1 0 0
125 1 0 background 0 lumi lnN 1 0 0
Writing new card and ROOT file: ('decorrelated_card.txt', 'decorrelated_card.shapes.root')

Break segmentation violation

adewit commented 3 years ago

Hi Mohsen, Thanks for reporting. We need to make some changes to the CardWriter to fix this - in the meantime can you change the last line: https://github.com/cms-analysis/CombineHarvester/blob/master/CombineTools/scripts/partialCorrelationEdit.py#L81 from cb.WriteDatacard(args.output_txt, args.output_root) To these 2 lines:

outputfile = ROOT.TFile(args.output_root, 'recreate')
cb.WriteDatacard(args.output_txt, outputfile)

It should then not seg fault.

(We'll make this change in the central CombineHarvester version as well, but probably not until a bit later)

Best, Adinda

setesami commented 3 years ago

Thank you very much Adinda. It works perfectly now.