Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warning where not needed and add filter to printWorkspaceNormlisations.py #912

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Combine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do
}

// Warn the user that they might be using funky values of POIs
if (!expectSignalSet_ && setPhysicsModelParameterExpression_ == "" && !(POI->getSize()==1 && POI->find("r"))) {
if (nToys!=0 && !expectSignalSet_ && setPhysicsModelParameterExpression_ == "" && !(POI->getSize()==1 && POI->find("r"))) {
std::cerr << "Warning! -- You haven't picked default values for the Parameters of Interest (either with --expectSignal or --setParameters) for generating toys. Combine will use the 'B-only' ModelConfig to generate, which may lead to undesired behaviour if not using the default Physics Model" << std::endl;
}
// Ok now we're ready to go lets save a "clean snapshot" for the current parameters state
Expand Down
31 changes: 30 additions & 1 deletion test/printWorkspaceNormalisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,22 @@
action="store_true",
help="Set to true if workspace built with --use-cms-histsum option.",
)
parser.add_option("", "--output-json", dest="output_json", default="", help="Output norms in json.")
parser.add_option(
"",
"--procFilter",
dest="process_filter_list",
type="string",
help="Filter (keep) only processes containing these names. Enter option as comma separated string",
)
parser.add_option(
"-m",
"--mass",
dest="massVal",
default=125,
type=float,
help="Set mass value in workspace (default=125).",
)
parser.add_option("", "--output-json", dest="output_json", default="", help="Output norms in json. Note, filters/thresholds are ignored for this output")


(options, args) = parser.parse_args()
Expand All @@ -68,6 +83,8 @@

file_in = ROOT.TFile(args[0])
ws = file_in.Get("w")
ws.var("MH").setVal(options.massVal)
print("Normalisation Values Evaluated at MH=", options.massVal)


def find_chan_proc(name):
Expand All @@ -78,6 +95,8 @@ def find_chan_proc(name):
return chan, proc


process_filter_list = options.process_filter_list.split(",")

chan_procs = {}

all_norms = ws.allFunctions().selectByName("n_exp_final*")
Expand Down Expand Up @@ -141,6 +160,14 @@ def find_chan_proc(name):
if type(prop) == ROOT.CMSHistSum:
chan_CMSHistSum_norms[chan] = dict(prop.getProcessNorms())


def checkFilter(proc):
for pc in process_filter_list:
if pc in proc:
return True
return False


# Now print out information
default_norms = od()

Expand All @@ -152,6 +179,8 @@ def find_chan_proc(name):
chanInfo = chan_procs[chan]
for proc in chanInfo:
skipProc = False
if not checkFilter(proc):
skipProc = True
if options.min_threshold > 0:
skipProc = proc[1].getVal() < options.min_threshold
if options.max_threshold > 0:
Expand Down
Loading