Skip to content

Commit

Permalink
Merge pull request #19 from kit-cn-cms/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
pkausw authored Dec 5, 2018
2 parents 08896c0 + 8d3db6a commit a1dcca0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/analysisObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def delete_uncertainty_for_all_processes(self,systematic):
if isinstance(systematic,list):
self.delete_uncertainties_for_all_processes(list_of_systematics=systematic)
elif isinstance(systematic,str):
print "deleting %s in all processes" % systematic
for category in self._categories:
for process in self._categories[category]:
self._categories[category][process].delete_uncertainty(systematicName=systematic)
Expand Down
2 changes: 1 addition & 1 deletion src/categoryObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def add_from_csv(self,pathToFile,signaltag="ttH",lumi=1.025, bgnorm=1.5):
if uncertainty in self[clear_procname]._uncertainties:
if self._debug >=30:
print "DEBUG: setting {0} to \t{1} and \t{2} for process {3}".format(uncertainty,typ,value, clear_procname)
self[clear_procname].set_uncertainty(syst=uncertainty,typ=typ,value=value)
self[clear_procname].set_uncertainty(systematicName=uncertainty,typ=typ,value=value)
else:
self[clear_procname].add_uncertainty(syst=uncertainty,typ=typ,value=value)

Expand Down
15 changes: 10 additions & 5 deletions src/datacardMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ class datacardMaker(object):
_debug = 200
def init_variables(self):
self._block_separator = "\n" + "-"*130 + "\n"

self._hardcode_numbers = True
self._replace_files = False

def __init__( self, analysis,
def __init__( self, analysis = None,
outputpath = "", replacefiles=False,
hardcodenumbers=False):
self.init_variables()
Expand All @@ -27,7 +28,8 @@ def __init__( self, analysis,
self.hardcode_numbers = hardcodenumbers
if outputpath:
self.outputpath = outputpath
self.write_datacard(analysis)
if analysis:
self.write_datacard(analysis)


@property
Expand Down Expand Up @@ -169,7 +171,8 @@ def create_header(self,analysis):

header.append("imax {0} number of bins".format(number_categories))
header.append("jmax {0} number of processes minus 1".format(number_processes))
header.append("kmax {0} number of nuisance parameters".format(number_systematics))
# header.append("kmax {0} number of nuisance parameters".format(number_systematics))
header.append("kmax * number of nuisance parameters")
return "\n".join(header)

def get_number_of_procs(self,analysis):
Expand Down Expand Up @@ -276,6 +279,7 @@ def get_max_size_keys(self,analysis):
keynames.append(process.file)
keynames.append(process.key_nominal_hist)
keynames.append(process.key_systematic_hist)
keynames = [x for x in keynames if x != "" and not x is None]
print keynames
return len(max(keynames,key=len))

Expand Down Expand Up @@ -415,7 +419,8 @@ def get_bkg_processes(self,analysis):
def get_max_size(self,liste):
templiste=[]
for element in liste:
templiste.append(max(element,key=len))
if not len(element) == 0:
templiste.append(max(element,key=len))
return len(max(templiste,key=len))


Expand Down

0 comments on commit a1dcca0

Please sign in to comment.