Skip to content

Commit

Permalink
Fix spelling mistakes in combine printout (#894)
Browse files Browse the repository at this point in the history
* Fix spelling mistakes in combine printout

* Fix linter complaint in Datacard.py

---------

Co-authored-by: nckw <n.c.k.wardle@googlemail.com>
  • Loading branch information
adewit and nucleosynthesis authored Jan 24, 2024
1 parent 3c69876 commit 800a90e
Show file tree
Hide file tree
Showing 59 changed files with 264 additions and 265 deletions.
16 changes: 8 additions & 8 deletions bin/combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ int main(int argc, char **argv) {
combiner.statOptions().add_options()
("toys,t", po::value<int>(&runToys)->default_value(0), "Number of Toy MC extractions")
("seed,s", po::value<int>(&seed)->default_value(123456), "Toy MC random seed")
("hintMethod,H", po::value<string>(&whichHintMethod)->default_value(""), "Run first this method to provide a hint on the result")
("hintMethod,H", po::value<string>(&whichHintMethod)->default_value(""), "First run this method to provide a hint on the result")
;
combiner.ioOptions().add_options()
("name,n", po::value<string>(&name)->default_value("Test"), "Name of the job, affects the name of the output tree")
("mass,m", po::value<float>(&iMass)->default_value(120.), "Higgs mass to store in the output tree")
("mass,m", po::value<float>(&iMass)->default_value(120.), "Mass to store in the output tree")
("dataset,D", po::value<string>(&dataset)->default_value("data_obs"), "Name of the dataset for observed limit - use this to replace dataset in workspace for example with a toy dataset. Format as file:workspace:object or file:object")
("dataMapName", po::value<string>(&dataMapName)->default_value("data_obs"), "Name of the dataset for observed limit pattern in the datacard")
("toysFile", po::value<string>(&toysFile)->default_value(""), "Read toy mc or other intermediate results from this file")
Expand Down Expand Up @@ -186,15 +186,15 @@ int main(int argc, char **argv) {
}

if (seed == -1) {
if (verbose > 0) std::cout << ">>> Using OpenSSL to get a really random seed " << std::endl;
if (verbose > 0) std::cout << ">>> Using OpenSSL to get a truly random seed " << std::endl;
FILE *rpipe = popen("openssl rand 8", "r");
if (rpipe == 0) { std::cout << "Error when running 'openssl rand 8'" << std::endl; return 2101; }
if (fread(&seed, sizeof(int), 1, rpipe) != 1) {
std::cout << "Error when reading from 'openssl rand 8'" << std::endl; return 2102;
}
std::cout << ">>> Used OpenSSL to get a really random seed " << seed << std::endl;
std::cout << ">>> Used OpenSSL to get a truly random seed " << seed << std::endl;
} else {
std::cout << ">>> random number generator seed is " << seed << std::endl;
std::cout << ">>> Random number generator seed is " << seed << std::endl;
}
RooRandom::randomGenerator()->SetSeed(seed);

Expand Down Expand Up @@ -232,7 +232,7 @@ int main(int argc, char **argv) {
combiner.applyOptions(vm);
CascadeMinimizer::applyOptions(vm);
} catch (std::exception &ex) {
cerr << "Error when configuring the combiner:\n\t" << ex.what() << std::endl;
cerr << "Error when configuring combine:\n\t" << ex.what() << std::endl;
return 2001;
}

Expand All @@ -243,7 +243,7 @@ int main(int argc, char **argv) {
cerr << "Error when configuring the algorithm " << whichMethod << ":\n\t" << ex.what() << std::endl;
return 2002;
}
cout << ">>> method used is " << whichMethod << endl;
cout << ">>> Method used is " << whichMethod << endl;

if (!whichHintMethod.empty()) {
map<string, LimitAlgo *>::const_iterator it_hint = methods.find(whichHintMethod);
Expand All @@ -255,7 +255,7 @@ int main(int argc, char **argv) {
}
hintAlgo = it_hint->second;
hintAlgo->applyDefaultOptions();
cout << ">>> method used to hint where the upper limit is " << whichHintMethod << endl;
cout << ">>> Method used to hint where the upper limit is " << whichHintMethod << endl;
}

TString fileName = "higgsCombine" + name + "."+whichMethod+"."+massName+toyName+"root";
Expand Down
14 changes: 7 additions & 7 deletions python/AdditionalModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## think about BRUndet and BRscal_hcc/gg/ss
class C8(SMLikeHiggsModel):
"assume the SM coupling but let the Higgs mass to float"
"assume the SM coupling but leave the Higgs mass to float"

def __init__(self):
SMLikeHiggsModel.__init__(self) # not using 'super(x,self).__init__' since I don't understand it
Expand All @@ -26,7 +26,7 @@ def setPhysicsOptions(self, physOptions):
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrama for Higgs mass range defined with inverterd order. Second must be larger the first")
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first")
if po == "doHZg":
self.doHZg = True
if po == "doHInv":
Expand Down Expand Up @@ -129,7 +129,7 @@ def getHiggsSignalYieldScale(self, production, decay, energy):


class CWidth(SMLikeHiggsModel):
"assume the SM coupling but let the Higgs mass to float"
"assume the SM coupling but leave the Higgs mass to float"

def __init__(self):
SMLikeHiggsModel.__init__(self) # not using 'super(x,self).__init__' since I don't understand it
Expand All @@ -147,7 +147,7 @@ def setPhysicsOptions(self, physOptions):
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrama for Higgs mass range defined with inverterd order. Second must be larger the first")
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first")
if po == "doHZg":
self.doHZg = True
if po == "doHInv":
Expand Down Expand Up @@ -288,7 +288,7 @@ def getHiggsSignalYieldScale(self, production, decay, energy):


class TwoHDM(SMLikeHiggsModel):
"assume the SM coupling but let the Higgs mass to float"
"assume the SM coupling but leave the Higgs mass to float"

def __init__(self):
SMLikeHiggsModel.__init__(self) # not using 'super(x,self).__init__' since I don't understand it
Expand All @@ -304,13 +304,13 @@ def setPhysicsOptions(self, physOptions):
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrama for Higgs mass range defined with inverterd order. Second must be larger the first")
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first")
if po.startswith("thdmtype="):
self.thdmtype = po.replace("thdmtype=", "")
if len(self.thdmtype) != 1:
raise RuntimeError("2HDM type requires one value")
elif int(self.thdmtype[0]) != 1 and int(self.thdmtype[0]) != 2 and int(self.thdmtype[0]) != 3 and int(self.thdmtype[0]) != 4:
raise RuntimeError("2HDM type must be 1 (default) or 2 or 3 or 4 ")
raise RuntimeError("2HDM type must be 1 (default), 2, 3, or 4 ")

def doParametersOfInterest(self):
"""Create POI out of signal strength and MH"""
Expand Down
9 changes: 4 additions & 5 deletions python/Datacard.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ class Datacard:
Description:
This is a container class that is filled by the function parseCards in HiggsAnalysis/CombinedLimit/python/DatacardParser.py.
This function parses a given datacards file and fills Datacard as a data structure that is easily accessible within python
scripts. To simplify access a set of getter c++ like function have been added to the class. Some more access function for
systematics will be added later.
This function parses a given datacards file and fills a Datacard as a data structure that is easily accessible within python
scripts. To simplify access, a set of getter c++-like functions has been added to the class.
"""

def __init__(self):
Expand Down Expand Up @@ -71,7 +70,7 @@ def __init__(self):

def print_structure(self):
"""
Print the contents of the -> should allow for direct text2workspace on python config
Print the contents of the container -> should allow for direct text2workspace on python config
"""
print(
"""
Expand Down Expand Up @@ -281,7 +280,7 @@ def obs(self, bin):

def rate(self, bin, proc):
"""
Return thenumber of expected events for a given bin and process.
Return the number of expected events for a given bin and process.
"""
return self.exp[bin][proc]

Expand Down
22 changes: 11 additions & 11 deletions python/DatacardParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,47 @@ def addDatacardParserOptions(parser):
dest="stat",
default=False,
action="store_true",
help="keep only statistical uncertainties, no systematics",
help="Keep only statistical uncertainties, no systematics",
)
parser.add_option(
"-f",
"--fix-pars",
dest="fixpars",
default=False,
action="store_true",
help="fix all floating parameters of the pdfs except for the POI",
help="Fix all floating parameters of the pdfs except for the POI",
)
parser.add_option(
"-c",
"--compiled",
dest="cexpr",
default=False,
action="store_true",
help="use compiled expressions (not suggested)",
help="Use compiled expressions (not suggested)",
)
parser.add_option(
"-a",
"--ascii",
dest="bin",
default=True,
action="store_false",
help="produce a Workspace in a rootfile in an HLF file (legacy, unsupported)",
help="Produce a workspace in a rootfile in an HLF file (legacy, unsupported)",
)
parser.add_option(
"-b",
"--binary",
dest="bin",
default=True,
action="store_true",
help="produce a Workspace in a rootfile (default)",
help="Produce a workspace in a rootfile (default)",
)
parser.add_option(
"-o",
"--out",
dest="out",
default=None,
type="string",
help="output file (if none, it will print to stdout). Required for binary mode.",
help="Output file (if none, it will print to stdout). Required for binary mode.",
)
parser.add_option(
"-v",
Expand All @@ -75,7 +75,7 @@ def addDatacardParserOptions(parser):
dest="mass",
default=0,
type="float",
help="Higgs mass to use. Will also be written in the Workspace as RooRealVar 'MH'.",
help="Mass to use. Will also be written in the workspace as RooRealVar 'MH'.",
)
parser.add_option(
"--dataMapName",
Expand Down Expand Up @@ -106,7 +106,7 @@ def addDatacardParserOptions(parser):
dest="poisson",
default=0,
type="int",
help="If set to a positive number, binned datasets wih more than this number of entries will be generated using poissonians",
help="If set to a positive number, binned datasets wih more than this number of entries will be generated using Poissonians",
)
parser.add_option(
"--default-morphing",
Expand Down Expand Up @@ -345,7 +345,7 @@ def addRateParam(lsyst, f, ret):

def parseCard(file, options):
if isinstance(file, str):
raise RuntimeError("You should pass as argument to parseCards a file object, stream or a list of lines, not a string")
raise RuntimeError("Argument to parseCards should be a file object, stream or a list of lines, not a string")
ret = Datacard()

# resetting these here to defaults, parseCard will fill them up
Expand Down Expand Up @@ -453,7 +453,7 @@ def parseCard(file, options):
if ret.isSignal[p] == None:
ret.isSignal[p] = s
elif ret.isSignal[p] != s:
raise RuntimeError("Process %s is declared as signal in some bin and as background in some other bin" % p)
raise RuntimeError("Process %s is declared as signal in some bins and as background in other bins" % p)
ret.signals = [p for p, s in ret.isSignal.items() if s]
if len(ret.signals) == 0 and not options.allowNoSignal:
raise RuntimeError("You must have at least one signal process (id <= 0)")
Expand Down Expand Up @@ -603,7 +603,7 @@ def parseCard(file, options):
ret.groups[groupName].update(set(groupNuisances))
else:
raise RuntimeError(
"Will not redefine group '%s'. It previously contained '%s' and you now wanted it to contain '%s'."
"Will not redefine group '%s'. It previously contained '%s' and you now want it to contain '%s'."
% (groupName, ret.groups[groupName], groupNuisances)
)

Expand Down
4 changes: 2 additions & 2 deletions python/DegenerateMatrixRank.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setPhysicsOptions(self, physOptions):
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger the first")
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first")

def doParametersOfInterest(self):
"""Create POI out of signal strength and MH"""
Expand Down Expand Up @@ -131,7 +131,7 @@ def setPhysicsOptions(self, physOptions):
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger the first")
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first")

def doParametersOfInterest(self):
"""Create POI out of signal strength and MH"""
Expand Down
10 changes: 5 additions & 5 deletions python/FloatingHiggsWidth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class FloatingHiggsWidth(SMLikeHiggsModel):
"assume the SM coupling but let the Higgs Total Width to float, i.e. allowing invisible decay"
"assume the SM coupling but leave the Higgs total width to float, i.e. allowing invisible decay"

def __init__(self):
SMLikeHiggsModel.__init__(self) # not using 'super(x,self).__init__' since I don't understand it
Expand All @@ -17,11 +17,11 @@ def setPhysicsOptions(self, physOptions):
for po in physOptions:
if po.startswith("higgsWidthRange="):
self.widthRange = po.replace("higgsWidthRange=", "").split(",")
print("The Higgs Width range:", self.widthRange)
print("The Higgs width range:", self.widthRange)
if len(self.widthRange) != 2:
raise RuntimeError("Higgs Width range definition requires two extrema")
raise RuntimeError("Higgs width range definition requires two extrema")
elif float(self.widthRange[0]) >= float(self.widthRange[1]):
raise RuntimeError("Extrama for Higgs Width range defined with inverterd order. Second must be larger the first")
raise RuntimeError("Extrema for Higgs width range defined with inverterd order. Second must be larger than the first")
if po.startswith("signalStrengthMode="):
self.rMode = po.replace("signalStrengthMode=", "")
if po.startswith("higgsMassRange="):
Expand All @@ -31,7 +31,7 @@ def setPhysicsOptions(self, physOptions):
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema.")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger the first.")
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first.")

def doParametersOfInterest(self):
"""Create POI out of signal strength and Width"""
Expand Down
6 changes: 3 additions & 3 deletions python/HTTAnomalousCouplings.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ class Anomalous_Interference_JHU_rw_HTTHZZ(Anomalous_Interference_JHU_rw, MultiS
def processPhysicsOptions(self, physOptions):
result = super(Anomalous_Interference_JHU_rw_HTTHZZ, self).processPhysicsOptions(physOptions)
if self.scaledifferentsqrtsseparately:
raise ValueError("Can't scaledifferentsqrtsseparately for HZZ+HTT combination")
raise ValueError("Can't scale different sqrts separately for HZZ+HTT combination")
if not self.scalemuvfseparately:
raise ValueError("Can't scalemuvmuftogether for HZZ+HTT combination")
raise ValueError("Can't scale muv muf together for HZZ+HTT combination")
if self.uservoverrf:
raise ValueError("Can't uservoverrf for HZZ+HTT combination")
raise ValueError("Can't use rv over rf for HZZ+HTT combination")
return result

def getPOIList(self):
Expand Down
2 changes: 1 addition & 1 deletion python/HiggsBenchmarkModels/CSquared.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setPhysicsOptions(self, physOptions):
if len(self.mHRange) != 2:
raise RuntimeError("Higgs mass range definition requires two extrema.")
elif float(self.mHRange[0]) >= float(self.mHRange[1]):
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger the first.")
raise RuntimeError("Extrema for Higgs mass range defined with inverterd order. Second must be larger than the first.")

def doParametersOfInterest(self):
"""Create POI out of signal strength and MH"""
Expand Down
Loading

0 comments on commit 800a90e

Please sign in to comment.