Skip to content

Commit

Permalink
Merge pull request #17 from kit-cn-cms/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
pkausw authored Nov 23, 2018
2 parents 7f4c5d5 + b38bf99 commit 08896c0
Show file tree
Hide file tree
Showing 9 changed files with 1,084 additions and 615 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ repo for object-oriented datacard maker
Writes Datacards

Current structure:
- src/datacardMaker.py: Wrapper to automatically create data cards from category/process/systematic objects
- src/datacardMaker.py: Wrapper to automatically create data cards from analysis objects
- src/analysisObject.py: Container for categoryObjects
- src/categoryObject.py: Object for categories that contains processes
- src/processObject.py: Object for process (e.g. ttH_hbb), contains uncertainties corresponding to the process
- src/systematicObject.py: object for nuisance parameters (e.g. bgnorm_ttbarPlusBBbar)
Expand Down
13 changes: 11 additions & 2 deletions base/identificationLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class identificationLogic(object):
, e.g. $SYSTEMATIC
(member variable: _systIden)
"""
_debug = 1
_debug = 100
_allowed_dependencies = ["process", "channel"]
def init_variables(self):
"""
Expand Down Expand Up @@ -132,10 +132,17 @@ def insert_channel(self, channel_name, base_key):
"""
build a key from 'base_key' for a specific channel 'channel_name'.
"""
print "-"*130
print "DEBUG Identification_logic INSERT_CHANNEL: entering function"
print "-"*130
if base_key is None or base_key == "":
print "unsuitable base_key!"
return ""
return ""
print channel_name
if not channel_name == "" and not channel_name is None:
print "-"*130
print base_key
print "-"*130
if self._chIden in base_key:
s = base_key.replace(self._chIden, channel_name)
if self._debug >= 30:
Expand Down Expand Up @@ -179,8 +186,10 @@ def build_nominal_histo_name( self, process_name, channel_name = "",
base_key = self._generic_nom_key
key = self.insert_process( process_name=process_name,
base_key = base_key)
print "DEBUG: Identification_logic - build_nominal_histo_name : key =", key
key = self.insert_channel( channel_name = channel_name,
base_key = key)
print "DEBUG: Identification_logic - build_nominal_histo_name : key =", key
return key

def build_systematic_histo_name_down( self, process_name = "",
Expand Down
11 changes: 10 additions & 1 deletion base/valueConventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class valueConventions(object):
def __init__(self):

print "Initializing valueConventions"
self._allowed_types = ["lnN", "shape"]
self._debug = 99

def isfloat(self, value):
try:
Expand All @@ -34,4 +36,11 @@ def is_good_systval(self, value):
is_good = all(self.isfloat(v) for v in totest)
if not is_good:
print "Given value not suitable for an uncertainty in a datacard!"
return is_good
return is_good

def is_allowed_type(self, typ):
if typ in self._allowed_types:
return True
if self._debug >= 99:
print "ERROR: Uncertainty type '%s' is not allowed"
return False
8 changes: 4 additions & 4 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# datacardMaker src
classes for object-oriented datacard maker

- datacardMaker.py: Wrapper to automatically create data cards from category/process/systematic objects
- a datacard maker object is able to have multiple categories with multiple processes with corresponding systematics
- datacardMaker.py: Wrapper to automatically create data cards from analysis objects
- write Datacard with write_datacard()
- analysisObject.py: Container for categoryObjects
- an analysis object is able to have multiple categories with multiple processes with corresponding systematics
- uses category, process and systematic objects
- add category with add_category()
- write Datacard with write_datacard()
- read Datacard with load_from_file()
- categoryObject.py: object for categories
- a category has multiple processes with a number of systematic uncertainties
- categoryObject knows generic keys for files and histogram names for data and uncertainties
Expand Down
Loading

0 comments on commit 08896c0

Please sign in to comment.