From 57fe274c1e567cd19fbdffe37a294e4f06c48420 Mon Sep 17 00:00:00 2001 From: Philip Daniel Keicher Date: Sun, 13 Jan 2019 11:49:29 +0100 Subject: [PATCH 1/3] fileHandler will now print file name, not physical address --- base/fileHandler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/fileHandler.py b/base/fileHandler.py index 0c56960..27a2b80 100644 --- a/base/fileHandler.py +++ b/base/fileHandler.py @@ -87,13 +87,13 @@ def load_histogram(self, histname): print "DEBUG: entering 'fileHandler.load_histogram'" if self._file: if self._debug >= 10: - print "DEBUG: loading histogram '%s' from '%s'" % (histname, file) + print "DEBUG: loading histogram '%s' from '%s'" % (histname, self._file.GetName()) h = self._file.Get(histname) if isinstance(h, TH1): return h else: print ("WARNING: histogram '%s' does not exist in '%s'" - % (histname, file)) + % (histname, self._file.GetName())) else: print "ERROR: In fileHandler - file is not set!" return None From 7d7642fd05b00a91c562ce84a4b66cd35db3a469 Mon Sep 17 00:00:00 2001 From: Philip Daniel Keicher Date: Sun, 13 Jan 2019 11:50:18 +0100 Subject: [PATCH 2/3] datacardMaker will now write data_obs shape line if root file is different than default --- src/datacardMaker.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/datacardMaker.py b/src/datacardMaker.py index a751cf5..42dd5c5 100644 --- a/src/datacardMaker.py +++ b/src/datacardMaker.py @@ -236,6 +236,14 @@ def write_keyword_process_lines(self,category,size,sizekeys): if not file=="" and not key_nominal_hist=="" and not key_systematic_hist=="": line.append(self.write_keyword_block_line(process_name=process,category_name=category.name,file=file, nominal_key=key_nominal_hist,syst_key=key_systematic_hist,size=size,sizekeys=sizekeys)) + data_obs = category.observation + if not data_obs is None and not data_obs.file == category.default_file: + file = data_obs.file + key_nominal_hist=data_obs.key_nominal_hist + key_systematic_hist=data_obs.key_systematic_hist + if not file=="" and not key_nominal_hist=="" and not key_systematic_hist=="": + line.append(self.write_keyword_block_line(process_name=data_obs.name,category_name=category.name,file=file, + nominal_key=key_nominal_hist,syst_key=key_systematic_hist,size=size,sizekeys=sizekeys)) return line def write_keyword_block_line(self, process_name, category_name, file, @@ -279,6 +287,11 @@ def get_max_size_keys(self,analysis): keynames.append(process.file) keynames.append(process.key_nominal_hist) keynames.append(process.key_systematic_hist) + process=analysis[category_name].observation + if not process is None: + 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)) From f23be0de27070d0e1b4bea917fb4e5f5277f9fb2 Mon Sep 17 00:00:00 2001 From: Philip Daniel Keicher Date: Sun, 13 Jan 2019 11:51:32 +0100 Subject: [PATCH 3/3] fileHandler is not static anymore, eventcount is recalculated when file is set --- src/processObject.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/processObject.py b/src/processObject.py index 665b7ba..f4c5258 100644 --- a/src/processObject.py +++ b/src/processObject.py @@ -12,7 +12,7 @@ class processObject(object): _id_logic = identificationLogic() identificationLogic.belongs_to = "process" _value_rules = valueConventions() - _file_handler = fileHandler() + def init_variables(self): self._name = "" @@ -24,6 +24,7 @@ def init_variables(self): self._uncertainties = {} self._debug = 100 self._calculate_yield = False + self._file_handler = fileHandler() def __init__( self, processName = None, pathToRootfile = None, @@ -125,6 +126,7 @@ def file(self, rootpath): print "setting filepath to", rootpath if path.exists(rootpath): self._file_handler.filepath = rootpath + self.eventcount = self.calculate_yield() else: print "file '%s' does not exist!" % rootpath