Skip to content

Support for multiple masses in datacards #338

Open
@IzaakWN

Description

@IzaakWN

I am trying to write a single datacard for multiple mass points:

cb.WriteDatacard(f"output/datacard.txt",f"output/datacard.inputs.root")

instead of

for mass in masses:
  cb.cp().mass([mass,'*']).WriteDatacard(f"output/datacard_M{mass}.txt",f"output/datacard_M{mass}.inputs.txt")

However, currently the writing routine throws an error:

if (masses.size() != 1) {
throw std::runtime_error(FNERROR("Process " + sig_proc + " in bin " +
bin +
" has multiple entries with multiple "
"mass values, this is not supported"));
}

I am wondering if there is a canonical way of doing this, or otherwise, we can add support for this? The inputs ROOT file would contain the histograms for all signal mass points, while writing the $MASS keyword in the datacard (which it already does, actually), and setting the signal rate to -1 to make Combine take the rate from the histogram's integral, see https://cms-analysis.github.io/HiggsAnalysis-CombinedLimit/latest/part2/settinguptheanalysis/?h=rate#rates-for-shape-analyses

Currently, an ugly workaround to get the histograms of all signal mass points written to the same ROOT file is the following:

outfname_txt  = "output/datacard.txt"
outfname_root = "output/datacard.inputs.root"
outfile_root  = TFile(outfname_root,'RECREATE')
for mass in masses: # write each signal mass point to ROOT file
  cb.cp().signals().mass([mass]).WriteDatacard(outfname_txt,outfile_root) # cannot handle multiple masses $MASS
cb.cp().signals().ForEachProc( lambda x: x.set_rate(-1) ) # tell Combine to take the rate from the histogram
cb.cp().mass([masses[0],'*']).WriteDatacard(outfname_txt,outfile_root)
outfile_root.Close()

But it's a bit ugly, and it overwrites the text file for each signal point, but all signal histograms in the ROOT file seem to retain the integral of their initial value.

Tagging @anigamova

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions