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

ValidateDatacards.py does cannot read csv inputs. #284

Open rymuelle opened 1 year ago

rymuelle commented 1 year ago

CMSSW: CMSSW_10_2_13

Higgs combine tool env:

  1. Branch: CMSSW_10_2_X
  2. Tag: v8.2.1 (for csv support)

CombineHarvester branch: master (last commit: 128e41eb70e12754cf084eb1eea622fe3722532b)


Example data cards and data:

https://gitlab.cern.ch/bff-zprime/exo-datacards/-/tree/EXO-22-006/EXO-22-006

Issue: While running ValidateDatacards.py datacard.txt I receive this error:

[SetFlag] Changing value of flag "check-negative-bins-on-import" from 1 to 0
[SetFlag] Changing value of flag "workspaces-use-clone" from 0 to 1
Error in <TFile::Init>: 2017_shapes_df_input.csv not a ROOT file
Traceback (most recent call last):
  File "/afs/cern.ch/work/r/rymuelle/public/nanoAODzPrime/higgscombine/CMSSW_10_2_13/bin/slc7_amd64_gcc700/ValidateDatacards.py", line 110, in <module>
    cb.ParseDatacard(args.cards,"","",mass=args.mass)
  File "/afs/cern.ch/work/r/rymuelle/public/nanoAODzPrime/higgscombine/CMSSW_10_2_13/python/CombineHarvester/CombineTools/ch.py", line 21, in ParseDatacard
    return self.__ParseDatacard__(card, analysis, era, channel, bin_id, mass)
RuntimeError: 
*******************************************************************************
Context: Function ch::CombineHarvester::ParseDatacard at 
  /afs/cern.ch/work/r/rymuelle/public/nanoAODzPrime/higgscombine/CMSSW_10_2_13/src/CombineHarvester/CombineTools/src/CombineHarvester_Datacards.cc:131
Problem: Workspace not found in file
*******************************************************************************
Please report issues at
  https://github.com/cms-analysis/CombineHarvester/issues
*******************************************************************************

I appears like it expects a root file. A search through the documentation and github repo did not clearly show a solution.

ajgilbert commented 1 year ago

Unfortunately this isn't supported, as CombineHarvester has a different datacard parser from combine, and we didn't implement csv support there. In the short term the only option would be to convert to normal TH1 input first. In the longer term we'd like to unify the CH and combine datacard parsers, but this is a big project.