Skip to content

Commit

Permalink
Merge pull request cms-sw#70 from pjdunne/shapelnnbugfix
Browse files Browse the repository at this point in the history
Bug fix for treatment of "shape?" type nuisances
  • Loading branch information
gpetruc committed Nov 30, 2013
2 parents 84168b8 + ac1194f commit 04ff742
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python/ModelTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,12 @@ def doExpectedEvents(self):
else:
raise RuntimeError, "Physics model returned something which is neither a name, nor 0, nor 1."
for (n,nofloat,pdf,args,errline) in self.DC.systs:
if pdf == "param" or pdf.startswith("shape"): continue
if pdf == "param":continue
if not errline[b].has_key(p): continue
if errline[b][p] == 0.0: continue
if pdf.startswith("shape") and pdf.endswith("?"): # might be a lnN in disguise
if not self.isShapeSystematic(b,p,n): pdf = "lnN"
if pdf.startswith("shape"): continue
if pdf == "lnN" and errline[b][p] == 1.0: continue
if pdf == "lnN" or pdf == "lnU":
if type(errline[b][p]) == list:
Expand Down
4 changes: 3 additions & 1 deletion python/ShapeTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ def getShape(self,channel,process,syst="",_fileCache={},_cache={},allowNoSyst=Fa
if self.wsp.ClassName() == "RooWorkspace":
ret = self.wsp.data(oname)
if not ret: ret = self.wsp.pdf(oname)
if not ret: raise RuntimeError, "Object %s in workspace %s in file %s does not exist or it's neither a data nor a pdf" % (oname, wname, finalNames[0])
if not ret:
if allowNoSyst: return None
raise RuntimeError, "Object %s in workspace %s in file %s does not exist or it's neither a data nor a pdf" % (oname, wname, finalNames[0])
# Fix the fact that more than one entry can refer to the same object
ret = ret.Clone()
ret.SetName("shape%s_%s_%s%s" % (postFix,process,channel, "_"+syst if syst else ""))
Expand Down

0 comments on commit 04ff742

Please sign in to comment.